# HG changeset patch # User David Demelier # Date 1331246916 -3600 # Node ID 2f71e113be63ec139583d072d13fdb8dbdcf49ef # Parent 7e72d4008f6d0ac3f7e00d947ccb9cab6fa040de Remove copy and ncopy and putc/puts diff -r 7e72d4008f6d -r 2f71e113be63 buf.c --- 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. */ diff -r 7e72d4008f6d -r 2f71e113be63 buf.h --- 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 *);