move ascii.* into the lib-lib.
[apps/madmutt.git] / buffer.c
index cfe19be..7f06132 100644 (file)
--- a/buffer.c
+++ b/buffer.c
 #include <ctype.h>
 
 #include <lib-lib/mem.h>
+#include <lib-lib/str.h>
 
 #include "buffer.h"
 
-#include "lib/mem.h"
-#include "lib/str.h"
 #include "lib/debug.h"
 
 /*
@@ -57,15 +56,15 @@ BUFFER *mutt_buffer_from (BUFFER * b, const char *seed)
     return NULL;
 
   b = mutt_buffer_init (b);
-  b->data = str_dup (seed);
-  b->dsize = str_len (seed);
+  b->data = m_strdup(seed);
+  b->dsize = m_strlen(seed);
   b->dptr = (char *) b->data + b->dsize;
   return b;
 }
 
 void mutt_buffer_addstr (BUFFER * buf, const char *s)
 {
-  mutt_buffer_add (buf, s, str_len (s));
+  mutt_buffer_add (buf, s, m_strlen(s));
 }
 
 void mutt_buffer_addch (BUFFER * buf, char c)
@@ -86,14 +85,14 @@ void mutt_buffer_free (BUFFER ** p)
 /* dynamically grows a BUFFER to accomodate s, in increments of 128 bytes.
  * Always one byte bigger than necessary for the null terminator, and
  * the buffer is always null-terminated */
-void mutt_buffer_add (BUFFER * buf, const char *s, size_t len)
+void mutt_buffer_add (BUFFER *buf, const char *s, size_t len)
 {
   size_t offset;
 
   if (buf->dptr + len + 1 > buf->data + buf->dsize) {
     offset = buf->dptr - buf->data;
     buf->dsize += len < 128 ? 128 : len + 1;
-    mem_realloc ((void **) &buf->data, buf->dsize);
+    p_realloc(&buf->data, buf->dsize);
     buf->dptr = buf->data + offset;
   }
   memcpy (buf->dptr, s, len);
@@ -228,8 +227,8 @@ int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags)
         p_delete(&expn.data);
       }
       else if (expn.data) {
-        expnlen = str_len (expn.data);
-        tok->dsize = expnlen + str_len (tok->dptr) + 1;
+        expnlen = m_strlen(expn.data);
+        tok->dsize = expnlen + m_strlen(tok->dptr) + 1;
         ptr = xmalloc(tok->dsize);
         memcpy (ptr, expn.data, expnlen);
         strcpy (ptr + expnlen, tok->dptr);      /* __STRCPY_CHECKED__ */