After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688269 - Cleanup _parse_kcmdline()
Cleanup _parse_kcmdline()
Status: RESOLVED FIXED
Product: gnome-session
Classification: Core
Component: gnome-session
3.6.x
Other Linux
: Normal normal
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-11-13 17:35 UTC by Bastien Nocera
Modified: 2013-01-13 22:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tools: Use GRegex in _parse_kcmdline() (3.79 KB, patch)
2013-01-13 18:32 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2012-11-13 17:35:29 UTC
In gnome-session-check-accelerated-helper.c
_parse_kcmdline() could probably use a regex instead.
Comment 1 Bastien Nocera 2013-01-13 18:32:55 UTC
Created attachment 233394 [details] [review]
tools: Use GRegex in _parse_kcmdline()

Makes the parsing code easier to understand.
Comment 2 Colin Walters 2013-01-13 21:44:24 UTC
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)
Comment 3 Bastien Nocera 2013-01-13 22:14:18 UTC
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()