fix asprintf warnings

Fix recently introduced compiler warnings:

desktop-shell/shell.c: In function 'shell_configuration':
desktop-shell/shell.c:588:10: warning: ignoring return value of
'asprintf', declared with attribute warn_unused_result [-Wunused-result]

src/screenshooter.c: In function ‘screenshooter_binding’:
src/screenshooter.c:291:10: warning: ignoring return value of
‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]

src/text-backend.c: In function ‘text_backend_configuration’:
src/text-backend.c:944:10: warning: ignoring return value of ‘asprintf’,
declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Pekka Paalanen 10 years ago
parent 052917aa2a
commit 974c094060
  1. 5
      desktop-shell/shell.c
  2. 8
      src/screenshooter.c
  3. 5
      src/text-backend.c

@ -575,6 +575,7 @@ shell_configuration(struct desktop_shell *shell)
struct weston_config_section *section; struct weston_config_section *section;
int duration; int duration;
char *s, *client; char *s, *client;
int ret;
section = weston_config_get_section(shell->compositor->config, section = weston_config_get_section(shell->compositor->config,
"screensaver", NULL, NULL); "screensaver", NULL, NULL);
@ -585,8 +586,10 @@ shell_configuration(struct desktop_shell *shell)
section = weston_config_get_section(shell->compositor->config, section = weston_config_get_section(shell->compositor->config,
"shell", NULL, NULL); "shell", NULL, NULL);
asprintf(&client, "%s/%s", weston_config_get_libexec_dir(), ret = asprintf(&client, "%s/%s", weston_config_get_libexec_dir(),
WESTON_SHELL_CLIENT); WESTON_SHELL_CLIENT);
if (ret < 0)
client = NULL;
weston_config_section_get_string(section, weston_config_section_get_string(section,
"client", &s, client); "client", &s, client);
free(client); free(client);

@ -287,9 +287,15 @@ screenshooter_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
{ {
struct screenshooter *shooter = data; struct screenshooter *shooter = data;
char *screenshooter_exe; char *screenshooter_exe;
int ret;
asprintf(&screenshooter_exe, "%s/%s", weston_config_get_libexec_dir(), ret = asprintf(&screenshooter_exe, "%s/%s",
weston_config_get_libexec_dir(),
"/weston-screenshooter"); "/weston-screenshooter");
if (ret < 0) {
weston_log("Could not construct screenshooter path.\n");
return;
}
if (!shooter->client) if (!shooter->client)
shooter->client = weston_client_launch(shooter->ec, shooter->client = weston_client_launch(shooter->ec,

@ -938,11 +938,14 @@ text_backend_configuration(struct text_backend *text_backend)
{ {
struct weston_config_section *section; struct weston_config_section *section;
char *client; char *client;
int ret;
section = weston_config_get_section(text_backend->compositor->config, section = weston_config_get_section(text_backend->compositor->config,
"input-method", NULL, NULL); "input-method", NULL, NULL);
asprintf(&client, "%s/weston-keyboard", ret = asprintf(&client, "%s/weston-keyboard",
weston_config_get_libexec_dir()); weston_config_get_libexec_dir());
if (ret < 0)
client = NULL;
weston_config_section_get_string(section, "path", weston_config_section_get_string(section, "path",
&text_backend->input_method.path, &text_backend->input_method.path,
client); client);

Loading…
Cancel
Save