projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use m_strdup and m_strlen that are inlined for efficiency
[apps/madmutt.git]
/
lib
/
rx.c
diff --git
a/lib/rx.c
b/lib/rx.c
index
c0f6982
..
5595108
100644
(file)
--- a/
lib/rx.c
+++ b/
lib/rx.c
@@
-8,16
+8,17
@@
#include "config.h"
#endif
#include "config.h"
#endif
+#include <lib-lib/mem.h>
+#include <lib-lib/str.h>
+
#include "rx.h"
#include "rx.h"
-#include "mem.h"
-#include "str.h"
rx_t *rx_compile (const char *s, int flags) {
rx_t *rx_compile (const char *s, int flags) {
- rx_t *pp =
mem_calloc (1, sizeof (rx_t)
);
+ rx_t *pp =
p_new(rx_t, 1
);
- pp->pattern =
str_dup
(s);
- pp->rx =
mem_calloc (1, sizeof (regex_t)
);
+ pp->pattern =
m_strdup
(s);
+ pp->rx =
p_new(regex_t, 1
);
if (REGCOMP(pp->rx, NONULL (s), flags) != 0)
rx_free (&pp);
if (REGCOMP(pp->rx, NONULL (s), flags) != 0)
rx_free (&pp);
@@
-25,10
+26,10
@@
rx_t *rx_compile (const char *s, int flags) {
}
void rx_free (rx_t** p) {
}
void rx_free (rx_t** p) {
-
mem_fre
e(&(*p)->pattern);
+
p_delet
e(&(*p)->pattern);
regfree ((*p)->rx);
regfree ((*p)->rx);
-
mem_fre
e(&(*p)->rx);
-
mem_fre
e(p);
+
p_delet
e(&(*p)->rx);
+
p_delet
e(p);
}
int rx_compare (const rx_t* r1, const rx_t* r2) {
}
int rx_compare (const rx_t* r1, const rx_t* r2) {