projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use safer p_clear when possible.
[apps/madmutt.git]
/
buffer.c
diff --git
a/buffer.c
b/buffer.c
index
bfa0dd8
..
e16b590
100644
(file)
--- a/
buffer.c
+++ b/
buffer.c
@@
-15,10
+15,10
@@
#include <ctype.h>
#include <lib-lib/mem.h>
#include <ctype.h>
#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
#include "buffer.h"
#include "buffer.h"
-#include "lib/str.h"
#include "lib/debug.h"
/*
#include "lib/debug.h"
/*
@@
-30,16
+30,12
@@
*/
BUFFER *mutt_buffer_init(BUFFER *b)
{
*/
BUFFER *mutt_buffer_init(BUFFER *b)
{
- if (!b) {
- b = p_new(BUFFER, 1);
- if (!b)
- return NULL;
- }
- else {
+ if (!b) {
+ b = p_new(BUFFER, 1);
+ }
p_delete(&b->data);
p_delete(&b->data);
- }
- memset (b, 0, sizeof (BUFFER));
- return b;
+ p_clear(b, 1);
+ return b;
}
/*
}
/*
@@
-56,15
+52,15
@@
BUFFER *mutt_buffer_from (BUFFER * b, const char *seed)
return NULL;
b = mutt_buffer_init (b);
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)
{
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)
}
void mutt_buffer_addch (BUFFER * buf, char c)
@@
-213,7
+209,7
@@
int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags)
tok->dptr = pc + 1;
/* read line */
tok->dptr = pc + 1;
/* read line */
-
memset (&expn, 0, sizeof (expn)
);
+
p_clear(&expn, 1
);
expn.data = mutt_read_line (NULL, &expn.dsize, fp, &line);
fclose (fp);
mutt_wait_filter (pid);
expn.data = mutt_read_line (NULL, &expn.dsize, fp, &line);
fclose (fp);
mutt_wait_filter (pid);
@@
-227,8
+223,8
@@
int mutt_extract_token (BUFFER * dest, BUFFER * tok, int flags)
p_delete(&expn.data);
}
else if (expn.data) {
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__ */
ptr = xmalloc(tok->dsize);
memcpy (ptr, expn.data, expnlen);
strcpy (ptr + expnlen, tok->dptr); /* __STRCPY_CHECKED__ */