Merge commit 'stable/20110609'
[gnulib.git] / lib / trim.c
index 6824200..6515cfa 100644 (file)
@@ -1,5 +1,5 @@
 /* Removes leading and/or trailing whitespaces
-   Copyright (C) 2006-2008 Free Software Foundation, Inc.
+   Copyright (C) 2006-2011 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #endif
 
 char *
-trim2(const char *s, int how)
+trim2 (const char *s, int how)
 {
   char *d;
 
-  d = strdup(s);
+  d = strdup (s);
 
   if (!d)
-    xalloc_die();
+    xalloc_die ();
 
   if (MB_CUR_MAX > 1)
     {
@@ -65,7 +65,7 @@ trim2(const char *s, int how)
       /* Trim trailing whitespaces. */
       if (how != TRIM_LEADING)
         {
-          int state = 0;
+          unsigned int state = 0;
           char *r IF_LINT (= NULL); /* used only while state = 2 */
 
           mbi_init (i, d, strlen (d));
@@ -130,4 +130,3 @@ trim2(const char *s, int how)
 
   return d;
 }
-