bti: allow compilation on non-GNU platforms
authorFabian Groffen <grobian@gentoo.org>
Sat, 24 Sep 2011 18:30:12 +0000 (20:30 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 22 Oct 2011 16:17:24 +0000 (18:17 +0200)
Avoid using strchrnul, it's a GNU addition.  The code in question,
actually doesn't really benefit from strchrnul's behaviour.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
config.c

index e06f480..2b510b9 100644 (file)
--- a/config.c
+++ b/config.c
@@ -351,20 +351,21 @@ void bti_parse_configfile(struct session *session)
                 * marker if it occurs at the beginning of the line, or after
                 * whitespace
                 */
-               hashmarker = strchrnul(line, '#');
+               hashmarker = strchr(line, '#');
                if (line == hashmarker)
                        line[0] = '\0';
                else {
-                       while (hashmarker[0] != '\0') {
+                       while (hashmarker != NULL) {
                                --hashmarker;
-                               if (isblank(hashmarker[0]))
+                               if (isblank(hashmarker[0])) {
                                        hashmarker[0] = '\0';
-                               else {
+                                       break;
+                               } else {
                                        /*
                                         * false positive; '#' occured
                                         * within a string
                                         */
-                                       hashmarker = strchrnul(hashmarker+2, '#');
+                                       hashmarker = strchr(hashmarker+2, '#');
                                }
                        }
                }