projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix compilation warnings in recvcmd.c
[apps/madmutt.git]
/
lib
/
rx.c
diff --git
a/lib/rx.c
b/lib/rx.c
index
1330af8
..
230bf3d
100644
(file)
--- a/
lib/rx.c
+++ b/
lib/rx.c
@@
-4,16
+4,21
@@
* please see the file GPL in the top level source directory.
*/
* please see the file GPL in the top level source directory.
*/
+#if HAVE_CONFIG_H
+#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 =
safe_calloc (sizeof (rx_t)
, 1);
+ rx_t *pp =
p_new(rx_t
, 1);
- pp->pattern =
safe_strdup
(s);
- pp->rx =
safe_calloc (sizeof (regex_t)
, 1);
+ 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);
@@
-21,19
+26,19
@@
rx_t *rx_compile (const char *s, int flags) {
}
void rx_free (rx_t** p) {
}
void rx_free (rx_t** p) {
-
FREE
(&(*p)->pattern);
+
p_delete
(&(*p)->pattern);
regfree ((*p)->rx);
regfree ((*p)->rx);
-
FREE
(&(*p)->rx);
-
FREE
(p);
+
p_delete
(&(*p)->rx);
+
p_delete
(p);
}
int rx_compare (const rx_t* r1, const rx_t* r2) {
}
int rx_compare (const rx_t* r1, const rx_t* r2) {
- return (m
utt_strcmp
(r1->pattern, r2->pattern));
+ return (m
_strcmp
(r1->pattern, r2->pattern));
}
int rx_list_match (list2_t* l, const char* pat) {
int i = 0;
}
int rx_list_match (list2_t* l, const char* pat) {
int i = 0;
- if (!pat || list_empty(l))
+ if (!pat ||
!*pat ||
list_empty(l))
return (0);
for (i = 0; i < l->length; i++)
if (REGEXEC(((rx_t*) l->data[i])->rx, pat) == 0)
return (0);
for (i = 0; i < l->length; i++)
if (REGEXEC(((rx_t*) l->data[i])->rx, pat) == 0)
@@
-46,7
+51,7
@@
int rx_lookup (list2_t* l, const char* pat) {
if (!pat || !*pat || list_empty(l))
return (-1);
for (i = 0; i < l->length; i++)
if (!pat || !*pat || list_empty(l))
return (-1);
for (i = 0; i < l->length; i++)
- if (m
utt_strcmp
(((rx_t*) l->data[i])->pattern, pat) == 0)
+ if (m
_strcmp
(((rx_t*) l->data[i])->pattern, pat) == 0)
return (i);
return (-1);
}
return (i);
return (-1);
}