optimize this a little bit.
authorEric Andersen <andersen@codepoet.org>
Sat, 29 Dec 2001 07:26:33 +0000 (07:26 -0000)
committerEric Andersen <andersen@codepoet.org>
Sat, 29 Dec 2001 07:26:33 +0000 (07:26 -0000)
libbb/chomp.c

index 94404a98d2df2e08cd9995cbed544c58abeff73f..e5a522f01df3665aa40217befb6e31bd87f38c98 100644 (file)
 #include <string.h>
 #include "libbb.h"
 
-
 void chomp(char *s)
 {
-       char *lc = last_char_is(s, '\n');
-       
-       if(lc)
-               *lc = 0;
+       if (!(s && *s)) return;
+       while (*s && (*s != '\n')) s++;
+       *s = 0;
 }