Added wrbuf_cut_right which cuts WRBUF by a number of characters (chop
[yaz-moved-to-github.git] / src / wrbuf.c
index e8e6434..973f080 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: wrbuf.c,v 1.16 2007-02-23 10:15:01 adam Exp $
+ * $Id: wrbuf.c,v 1.17 2007-03-18 12:59:56 adam Exp $
  */
 
 /**
@@ -231,6 +231,13 @@ const char *wrbuf_cstr(WRBUF b)
     return b->buf;
 }
 
+void wrbuf_cut_right(WRBUF b, size_t no_to_remove)
+{
+    if (no_to_remove > b->pos)
+        no_to_remove = b->pos;
+    b->pos = b->pos - no_to_remove;
+}
+
 /*
  * Local variables:
  * c-basic-offset: 4