Hi! > This allows you to specify an array of config_par, ending it with NULL > name, so that you don't have to calculate the number of entries manually. >
> -int parse(char *my_name, char *file_name, int parc, struct config_par *parv) > +int parse(char *my_name, char *file_name, struct config_par *parv) > { > char *str, *dst, *fmt, buf[MAX_STR_LEN]; > struct stat stat_buf; > @@ -61,7 +62,7 @@ int parse(char *my_name, char *file_name > if (!*str) > continue; > /* Compare with parameter names */ > - for (j = 0; j < parc; j++) { > + for (j = 0;parv[j].name != NULL;j++) { spaces after ;, please, and drop unneccessary != NULL. > @@ -94,7 +95,7 @@ int parse(char *my_name, char *file_name > } > } > } > - if (j >= parc) > + if (parv[j].name == NULL) > error = -EINVAL; if (!parv[j].name) is both shorter and more readable. > --- suspend.org/resume.c 2007-05-13 20:53:13.000000000 +0300 > +++ suspend.work/resume.c 2007-08-04 15:19:57.000000000 +0300 > @@ -54,7 +50,7 @@ static char decrypt; > @@ -125,5 +124,11 @@ static struct config_par parameters[PARA > .ptr = NULL, > }, > + { > + .name = NULL, > + .fmt = NULL, > + .ptr = NULL, > + .len = 0, You can safely drop .fmt, .ptr and .len, right? Actually, you could drop .name, too, but this should make it clearer. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel