aboutsummaryrefslogtreecommitdiffstats
path: root/src/afm-launch.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2015-12-29 15:23:40 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2015-12-29 15:31:43 +0100
commitdf95c86712d96754a4d660e9ddf98bdbad746cf4 (patch)
tree09532142b4e963c90bd8e25af05132437c63aec9 /src/afm-launch.c
parent36a5034839183d1c49b63e4cbd955004bf46a8b3 (diff)
fix some warnings
Change-Id: Ibcdc33feb279309633a78b51d59d26846b259003
Diffstat (limited to 'src/afm-launch.c')
-rw-r--r--src/afm-launch.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/afm-launch.c b/src/afm-launch.c
index 937366d..1f9907d 100644
--- a/src/afm-launch.c
+++ b/src/afm-launch.c
@@ -107,25 +107,26 @@ static char **instantiate_arguments(const char **args, struct afm_launch_desc *d
{
const char **iter, *p, *v;
char *data, **result, port[20], width[20], height[20], mini[3], c;
- int n, s, x;
+ int n, s;
/* init */
mini[0] = '%';
mini[2] = 0;
/* loop that either compute the size and build the result */
- n = s = x = 0;
+ data = NULL;
+ n = s = 0;
for (;;) {
iter = args;
n = 0;
while (*iter) {
p = *iter++;
- if (x)
+ if (data)
result[n] = data;
n++;
while((c = *p++) != 0) {
if (c != '%') {
- if (x)
+ if (data)
*data++ = c;
else
s++;
@@ -133,7 +134,7 @@ static char **instantiate_arguments(const char **args, struct afm_launch_desc *d
c = *p++;
switch (c) {
case 'I': v = FWK_ICON_DIR; break;
- case 'P': if(!x) sprintf(port, "%d", params->port); v = port; break;
+ case 'P': if(!data) sprintf(port, "%d", params->port); v = port; break;
case 'S': v = params->secret; break;
case 'D': v = params->datadir; break;
case 'r': v = desc->path; break;
@@ -144,23 +145,23 @@ static char **instantiate_arguments(const char **args, struct afm_launch_desc *d
case 'm': v = desc->type; break;
case 'n': v = desc->name; break;
case 'p': v = "" /*desc->plugins*/; break;
- case 'W': if(!x) sprintf(width, "%d", desc->width); v = width; break;
- case 'H': if(!x) sprintf(height, "%d", desc->height); v = height; break;
+ case 'W': if(!data) sprintf(width, "%d", desc->width); v = width; break;
+ case 'H': if(!data) sprintf(height, "%d", desc->height); v = height; break;
case '%': c = 0;
default: mini[1] = c; v = mini; break;
}
- if (x)
+ if (data)
data = stpcpy(data, v);
else
s += strlen(v);
}
}
- if (x)
+ if (data)
*data++ = 0;
else
s++;
}
- if (x) {
+ if (data) {
result[n] = NULL;
return result;
}
@@ -171,7 +172,6 @@ static char **instantiate_arguments(const char **args, struct afm_launch_desc *d
return NULL;
}
data = (char*)(&result[n + 1]);
- x = 1;
}
}