]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libudev-util: change util_replace_whitespace to return number of chars in dest
authorDan Streetman <ddstreet@ieee.org>
Tue, 3 Jan 2017 19:31:45 +0000 (14:31 -0500)
committerDan Streetman <ddstreet@ieee.org>
Tue, 3 Jan 2017 22:09:46 +0000 (17:09 -0500)
Instead of returning 0, which is unhelpful, return the number of chars
copied into the dest string.  This allows callers that care about that
to easily use it, instead of having to calculate the strlen.

No current users of the function check the return value, so this does not
break any existing code; it is used in the following patch.

src/libudev/libudev-util.c

index 574cfeac85684dd9bdafb12f6fd8b861b81434b6..a9819b9db30e0b0a2a4ca1d138ffe5b0ec00b9b0 100644 (file)
@@ -186,7 +186,7 @@ int util_replace_whitespace(const char *str, char *to, size_t len)
                 to[j++] = str[i++];
         }
         to[j] = '\0';
-        return 0;
+        return j;
 }
 
 /* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */