Skip to content

Commit a9d99b3

Browse files
committed
libudev-util: change util_replace_whitespace to return number of chars in dest
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.
1 parent dc7dd61 commit a9d99b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libudev/libudev-util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ int util_replace_whitespace(const char *str, char *to, size_t len)
186186
to[j++] = str[i++];
187187
}
188188
to[j] = '\0';
189-
return 0;
189+
return j;
190190
}
191191

192192
/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */

0 commit comments

Comments
 (0)