]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - src/substitution.c
Don't allow +Z to be set by default_umodes
[irc/rqf/shadowircd.git] / src / substitution.c
index c899ff42e1985dc6cc6ae5bfdce8ddd2bd5cf530..708dce23c83f89b975bf11f571acbf1de5bf75d6 100644 (file)
  */
 
 #include "stdinc.h"
-#include "tools.h"
-#include "balloc.h"
 #include "s_user.h"
-#include "irc_string.h"
+#include "snomask.h"
+#include "match.h"
+#include "substitution.h"
 
 /*
  * Simple mappings for $foo -> 'bar'.
@@ -59,10 +59,10 @@ struct substitution_variable
  */
 void substitution_append_var(rb_dlink_list *varlist, const char *name, const char *value)
 {
-       struct substitution_variable *tmp = MyMalloc(sizeof(struct substitution_variable));
+       struct substitution_variable *tmp = rb_malloc(sizeof(struct substitution_variable));
 
-       DupString(tmp->name, name);
-       DupString(tmp->value, value);
+       tmp->name = rb_strdup(name);
+       tmp->value = rb_strdup(value);
 
        rb_dlinkAddAlloc(tmp, varlist);
 }
@@ -78,14 +78,14 @@ void substitution_free(rb_dlink_list *varlist)
 {
        rb_dlink_node *nptr, *nptr2;
 
-       DLINK_FOREACH_SAFE(nptr, nptr2, varlist->head)
+       RB_DLINK_FOREACH_SAFE(nptr, nptr2, varlist->head)
        {
                struct substitution_variable *tmp = (struct substitution_variable *) nptr->data;
 
                rb_dlinkDelete(nptr, varlist);
-               MyFree(tmp->name);
-               MyFree(tmp->value);
-               MyFree(tmp);
+               rb_free(tmp->name);
+               rb_free(tmp->value);
+               rb_free(tmp);
        }
 }
 
@@ -132,13 +132,13 @@ char *substitution_parse(const char *fmt, rb_dlink_list *varlist)
                        /* advance ptr by length of variable */
                        ptr += (pptr - ptr);
 
-                       DLINK_FOREACH(nptr, varlist->head)
+                       RB_DLINK_FOREACH(nptr, varlist->head)
                        {
                                struct substitution_variable *val = (struct substitution_variable *) nptr->data;
 
                                if (!strcasecmp(varname, val->name))
                                {
-                                       strlcpy(bptr, val->value, BUFSIZE - (bptr - buf));
+                                       rb_strlcpy(bptr, val->value, BUFSIZE - (bptr - buf));
                                        bptr += strlen(val->value);
                                        break;
                                }