GNOME Bugzilla – Bug 688269
Cleanup _parse_kcmdline()
Last modified: 2013-01-13 22:14:21 UTC
In gnome-session-check-accelerated-helper.c _parse_kcmdline() could probably use a regex instead.
Created attachment 233394 [details] [review] tools: Use GRegex in _parse_kcmdline() Makes the parsing code easier to understand.
Review of attachment 233394 [details] [review]: Two minor style bits, otherwise good to commit. ::: tools/gnome-session-check-accelerated-helper.c @@ +114,3 @@ + regex = g_regex_new ("gnome.fallback=(\\S+)", 0, G_REGEX_MATCH_NOTEMPTY, NULL); + if (g_regex_match (regex, contents, G_REGEX_MATCH_NOTEMPTY, &match) == FALSE) Is there a reason for == FALSE instead of just if (!...) ? @@ +123,3 @@ + fprintf (stderr, "gnome-session-is-accelerated: Invalid value '%s' for gnome.fallback passed in kernel command line.\n", arg); + else + ret = atoi (word + strlen ("gnome.fallback=")); atoi (arg)
With the fixes mentioned. > Is there a reason for == FALSE instead of just if (!...) ? Nope, just the style I usually use. > atoi (arg) Yep, forgot to change it after reworking the error message. Attachment 233394 [details] pushed as 8c26668 - tools: Use GRegex in _parse_kcmdline()