X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcommon.h;h=7c0d9369cf498db70712958a6d593ccb0d58d3e8;hb=5d9ad0bcb8b1ae1b7b0994f51237c04273f5cfbc;hp=2c74436318fecee1f9189bbfb6e658e28531d3f1;hpb=917c18f7783c176e0df13a017f1ca1213724910c;p=collectd.git diff --git a/src/common.h b/src/common.h index 2c744363..7c0d9369 100644 --- a/src/common.h +++ b/src/common.h @@ -208,6 +208,13 @@ int strsubstitute (char *str, char c_from, char c_to); */ int strunescape (char *buf, size_t buf_len); +/** + * Removed trailing newline characters (CR and LF) from buffer, which must be + * null terminated. Returns the length of the resulting string. + */ +__attribute__((nonnull (1))) +size_t strstripnewline (char *buffer); + /* * NAME * timeval_cmp @@ -296,7 +303,7 @@ typedef int (*dirwalk_callback_f)(const char *dirname, const char *filename, int walk_directory (const char *dir, dirwalk_callback_f callback, void *user_data, int hidden); /* Returns the number of bytes read or negative on error. */ -int read_file_contents (const char *filename, char *buf, int bufsize); +ssize_t read_file_contents (char const *filename, char *buf, size_t bufsize); counter_t counter_diff (counter_t old_value, counter_t new_value);