* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "conv.h"
+#include "err.h"
+#include "str.h"
+
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h> /* for uint32_t on Linux and OS X */
-
-#include "conv.h"
-#include "err.h"
-#include "str.h"
+#include <unistd.h>
#define INITIAL_LEN 1024
str_append_u32(struct str *s, const uint32_t i, const int mod_sep)
{
char out[I32_MAXLEN];
- int pos, len;
+ int pos;
+ unsigned int len;
uint32_t rem, next;
if (i == 0) {
str_append_u64(struct str *s, const uint64_t i, const int mod_sep)
{
char out[I64_MAXLEN];
- int pos, len;
+ int pos;
+ unsigned int len;
uint64_t rem, next;
uint32_t rem32, next32;
*
* %x is equivalent to %02x and expects a uint8_t
*/
-static void
-str_vappendf(struct str *s, const char *format, va_list va)
-{
+void str_vappendf(struct str *s, const char *format, va_list va) {
size_t pos, len;
len = strlen(format);
return buf;
}
+ssize_t str_write(const struct str * const buf, const int fd) {
+ return write(fd, buf->buf, buf->len);
+}
+
+size_t str_len(const struct str * const buf) {
+ return buf->len;
+}
+
/* vim:set ts=3 sw=3 tw=78 expandtab: */