summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-02-20 15:27:49 -0500
committerKristian Høgsberg <krh@bitplanet.net>2013-02-20 15:27:49 -0500
commit4172f668e7838a0e89d09b569d99745228c1c9c0 (patch)
tree6e6ee4be97767deb50e9a34660ec744e06974498 /shared
parentd5a97ae053b92dd1050a2cd42287d6c7840fe88c (diff)
downloadweston-4172f668e7838a0e89d09b569d99745228c1c9c0.tar.gz
Pass argc pointer to parse_options()
This lets us keep argc up to date as the backend picks out arguments from the argv array.
Diffstat (limited to 'shared')
-rw-r--r--shared/config-parser.h2
-rw-r--r--shared/option-parser.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/shared/config-parser.h b/shared/config-parser.h
index 7fa9c3f5..314057ae 100644
--- a/shared/config-parser.h
+++ b/shared/config-parser.h
@@ -67,7 +67,7 @@ struct weston_option {
int
parse_options(const struct weston_option *options,
- int count, int argc, char *argv[]);
+ int count, int *argc, char *argv[]);
#endif /* CONFIGPARSER_H */
diff --git a/shared/option-parser.c b/shared/option-parser.c
index 600f1107..a7e497ff 100644
--- a/shared/option-parser.c
+++ b/shared/option-parser.c
@@ -51,11 +51,11 @@ handle_option(const struct weston_option *option, char *value)
int
parse_options(const struct weston_option *options,
- int count, int argc, char *argv[])
+ int count, int *argc, char *argv[])
{
int i, j, k, len = 0;
- for (i = 1, j = 1; i < argc; i++) {
+ for (i = 1, j = 1; i < *argc; i++) {
for (k = 0; k < count; k++) {
if (options[k].name)
len = strlen(options[k].name);
@@ -77,6 +77,7 @@ parse_options(const struct weston_option *options,
argv[j++] = argv[i];
}
argv[j] = NULL;
+ *argc = j;
return j;
}