changeset 129:2f71e113be63

Remove copy and ncopy and putc/puts
author David Demelier <markand@malikania.fr>
date Thu, 08 Mar 2012 23:48:36 +0100
parents 7e72d4008f6d
children 1513cf3a985e
files buf.c buf.h
diffstat 2 files changed, 22 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/buf.c	Thu Mar 08 10:27:27 2012 +0100
+++ b/buf.c	Thu Mar 08 23:48:36 2012 +0100
@@ -89,28 +89,6 @@
 }
 
 /*
- * Copy at most max character from str to string buffer.
- */
-
-int
-buf_ncopy(struct buf *buf, const char *str, size_t max)
-{
-	buf_clear(buf);
-
-	return buf_ncat(buf, str, max);
-}
-
-/*
- * Copy the string str to the string buffer.
- */
-
-int
-buf_copy(struct buf *buf, const char *str)
-{
-	return buf_ncopy(buf, str, strlen(str));
-}
-
-/*
  * Concatenate the printf(3) like call to the string buffer, this function
  * returns -1 on fixed safe buffer, otherwise 0 is returned if there
  * is no allocation failure.
@@ -164,6 +142,26 @@
 }
 
 /*
+ * Append the caracter c to the end of buffer
+ */
+
+int
+buf_putc(struct buf *buf, int c)
+{
+	return buf_printf(buf, "%c", c);
+}
+
+/*
+ * Just an alias for buf_cat.
+ */
+
+int
+buf_puts(struct buf *buf, const char *str)
+{
+	return buf_printf(buf, "%s", str);
+}
+
+/*
  * Clear the string buffer.
  */
 
--- a/buf.h	Thu Mar 08 10:27:27 2012 +0100
+++ b/buf.h	Thu Mar 08 23:48:36 2012 +0100
@@ -50,11 +50,11 @@
 int	buf_init(struct buf *);
 void	buf_set(struct buf *, const char *, ...);
 int	buf_ncat(struct buf *, const char *, size_t);
-int	buf_cat(struct buf *, const char *);
-int	buf_ncopy(struct buf *, const char *, size_t);
 int	buf_copy(struct buf *, const char *);
 int	buf_vprintf(struct buf *, const char *, va_list);
 int	buf_printf(struct buf *, const char *, ...);
+int	buf_putc(struct buf *, int);
+int	buf_puts(struct buf *, const char *);
 void	buf_clear(struct buf *);
 void	buf_free(struct buf *);