On Sat, Dec 07, 2013 at 04:48:46PM +0100, Daniel Martin wrote: > Signed-off-by: Daniel Martin <consume.no...@gmail.com> > --- > include/misc.h | 1 + > os/utils.c | 16 ++++++++++++++++ > 2 files changed, 17 insertions(+) > > diff --git a/include/misc.h b/include/misc.h > index 17de710..aab556a 100644 > --- a/include/misc.h > +++ b/include/misc.h > @@ -246,6 +246,7 @@ padding_for_int32(const int bytes) > } > > > +extern int xrtrim(char *str, int str_len); > extern char **xstrtokenize(const char *str, const char *separators); > extern void FormatInt64(int64_t num, char *string); > extern void FormatUInt64(uint64_t num, char *string); > diff --git a/os/utils.c b/os/utils.c > index fb20da7..56a1a6d 100644 > --- a/os/utils.c > +++ b/os/utils.c > @@ -1943,6 +1943,22 @@ CheckUserAuthorization(void) > } > > /* > + * Right-trim a string. Returns the string length after trimming. > + */ > +int > +xrtrim(char *str, int str_len)
can we divide this into two functions, one with a length argument and one without? cheap enough to do it now even if your patchset doesn't need it atm. > +{ > + int i = str_len; > + > + while (i > 0 && !isgraph(str[i - 1])) > + i--; > + > + str[i] = '\0'; > + > + return i; > +} > + > +/* > * Tokenize a string into a NULL terminated array of strings. Always returns > * an allocated array unless an error occurs. > */ > -- > 1.8.4.2 > fwiw, this is exactly that type of function that the tests in xserver/test/ are useful for (possibly the only thing...) so I'd prefer to see a few tests just to make sure we don't screw this up in the future. Cheers, Peter _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel