Thread (36 messages) flat view 36 messages, 7 authors, 2016-06-15

Re: [PATCH 1/3] Add strbuf_rtrim (to remove trailing spaces).

From: René Scharfe <hidden>
Date: 2016-06-15 22:43:34

Pierre Habouzit schrieb:
quoted hunk ↗ jump to hunk
diff --git a/strbuf.c b/strbuf.c
index acc7fc8..565c343 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -28,6 +28,13 @@ void strbuf_grow(struct strbuf *sb, size_t extra) {
 	ALLOC_GROW(sb->buf, sb->len + extra + 1, sb->alloc);
 }
 
+void strbuf_rtrim(struct strbuf *sb)
+{
+    while (sb->len > 0 && isspace((unsigned char)sb->buf[sb->len - 1]))
+        sb->len--;
+    sb->buf[sb->len] = '\0';
+}
Please use tabs instead of spaces to indent, just like you did in your
other patches. :)

René
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help