- Renamed DupString() to xstrdup()
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 23 Dec 2014 20:12:39 +0000 (20:12 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 23 Dec 2014 20:12:39 +0000 (20:12 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5092 82007160-df01-0410-b94d-b575c5fd34c7

Makefile.in
src/config-parser.c
src/config-parser.y
src/config.c
src/irc.c
src/malloc.c
src/malloc.h
src/opercmd.c
src/scan.c

index f517b0be482cee66568e25897a751c45677270c3..3a382a5684a91d5138d3eb5bda07a5b2888e0231 100644 (file)
@@ -81,7 +81,7 @@ subdir = .
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
        $(top_srcdir)/configure $(am__configure_deps) mkinstalldirs \
        INSTALL README compile config.guess config.sub install-sh \
-       missing ylwrap ltmain.sh
+       missing ltmain.sh
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
index c1785d25482910e28a08c2ba5c1335d875a31684..268d62e55fe580ca4fab11e2258fdf19da88cda0 100644 (file)
@@ -1656,7 +1656,7 @@ yyreduce:
 #line 148 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(OptionsItem->pidfile);
-   OptionsItem->pidfile = DupString((yyvsp[-1].string));
+   OptionsItem->pidfile = xstrdup((yyvsp[-1].string));
 }
 #line 1662 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1673,7 +1673,7 @@ yyreduce:
 #line 159 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(OptionsItem->scanlog);
-   OptionsItem->scanlog = DupString((yyvsp[-1].string));
+   OptionsItem->scanlog = xstrdup((yyvsp[-1].string));
 }
 #line 1679 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1682,7 +1682,7 @@ yyreduce:
 #line 189 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->away);
-   IRCItem->away = DupString((yyvsp[-1].string));
+   IRCItem->away = xstrdup((yyvsp[-1].string));
 }
 #line 1688 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1691,7 +1691,7 @@ yyreduce:
 #line 195 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->kline);
-   IRCItem->kline = DupString((yyvsp[-1].string));
+   IRCItem->kline = xstrdup((yyvsp[-1].string));
 }
 #line 1697 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1700,7 +1700,7 @@ yyreduce:
 #line 201 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->mode);
-   IRCItem->mode = DupString((yyvsp[-1].string));
+   IRCItem->mode = xstrdup((yyvsp[-1].string));
 }
 #line 1706 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1709,7 +1709,7 @@ yyreduce:
 #line 207 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->nick);
-   IRCItem->nick = DupString((yyvsp[-1].string));
+   IRCItem->nick = xstrdup((yyvsp[-1].string));
 }
 #line 1715 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1718,7 +1718,7 @@ yyreduce:
 #line 213 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->nickserv);
-   IRCItem->nickserv = DupString((yyvsp[-1].string));
+   IRCItem->nickserv = xstrdup((yyvsp[-1].string));
 }
 #line 1724 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1727,7 +1727,7 @@ yyreduce:
 #line 219 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->oper);
-   IRCItem->oper = DupString((yyvsp[-1].string));
+   IRCItem->oper = xstrdup((yyvsp[-1].string));
 }
 #line 1733 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1736,7 +1736,7 @@ yyreduce:
 #line 225 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->password);
-   IRCItem->password = DupString((yyvsp[-1].string));
+   IRCItem->password = xstrdup((yyvsp[-1].string));
 }
 #line 1742 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1745,7 +1745,7 @@ yyreduce:
 #line 231 "config-parser.y" /* yacc.c:1646  */
     {
    node_t *node;
-   node = node_create(DupString((yyvsp[-1].string)));
+   node = node_create(xstrdup((yyvsp[-1].string)));
 
    list_add(IRCItem->performs, node);
 }
@@ -1764,7 +1764,7 @@ yyreduce:
 #line 244 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->realname);
-   IRCItem->realname = DupString((yyvsp[-1].string));
+   IRCItem->realname = xstrdup((yyvsp[-1].string));
 }
 #line 1770 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1773,7 +1773,7 @@ yyreduce:
 #line 250 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->server);
-   IRCItem->server = DupString((yyvsp[-1].string));
+   IRCItem->server = xstrdup((yyvsp[-1].string));
 }
 #line 1779 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1782,7 +1782,7 @@ yyreduce:
 #line 256 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->username);
-   IRCItem->username = DupString((yyvsp[-1].string));
+   IRCItem->username = xstrdup((yyvsp[-1].string));
 }
 #line 1788 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1791,7 +1791,7 @@ yyreduce:
 #line 262 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->vhost);
-   IRCItem->vhost = DupString((yyvsp[-1].string));
+   IRCItem->vhost = xstrdup((yyvsp[-1].string));
 }
 #line 1797 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1800,7 +1800,7 @@ yyreduce:
 #line 268 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(IRCItem->connregex);
-   IRCItem->connregex = DupString((yyvsp[-1].string));
+   IRCItem->connregex = xstrdup((yyvsp[-1].string));
 }
 #line 1806 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1813,9 +1813,9 @@ yyreduce:
 
    item = MyMalloc(sizeof *item);
 
-   item->name = DupString("");
-   item->key = DupString("");
-   item->invite = DupString("");
+   item->name = xstrdup("");
+   item->key = xstrdup("");
+   item->invite = xstrdup("");
 
    node = node_create(item);
    list_add(IRCItem->channels, node);
@@ -1831,7 +1831,7 @@ yyreduce:
    struct ChannelConf *item = tmp;
 
    MyFree(item->name);
-   item->name = DupString((yyvsp[-1].string));
+   item->name = xstrdup((yyvsp[-1].string));
 }
 #line 1837 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1842,7 +1842,7 @@ yyreduce:
    struct ChannelConf *item = tmp;
 
    MyFree(item->key);
-   item->key = DupString((yyvsp[-1].string));
+   item->key = xstrdup((yyvsp[-1].string));
 }
 #line 1848 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1853,7 +1853,7 @@ yyreduce:
    struct ChannelConf *item = tmp;
 
    MyFree(item->invite);
-   item->invite = DupString((yyvsp[-1].string));
+   item->invite = xstrdup((yyvsp[-1].string));
 }
 #line 1859 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1883,7 +1883,7 @@ yyreduce:
    struct UserConf *item = (struct UserConf *) tmp;
 
    node_t *node;
-   node = node_create((void *) DupString((yyvsp[-1].string)));
+   node = node_create((void *) xstrdup((yyvsp[-1].string)));
 
    list_add(item->masks, node);
 }
@@ -1896,7 +1896,7 @@ yyreduce:
    struct UserConf *item = (struct UserConf *) tmp;
 
    node_t *node;
-   node = node_create((void *) DupString((yyvsp[-1].string)));
+   node = node_create((void *) xstrdup((yyvsp[-1].string)));
 
    list_add(item->scanners, node);
 }
@@ -1912,15 +1912,15 @@ yyreduce:
    item = MyMalloc(sizeof *item);
 
    /* Setup ScannerConf defaults */
-   item->name = DupString("undefined");
+   item->name = xstrdup("undefined");
 
        if(LIST_SIZE(ScannerItemList) > 0)
        {
           olditem = ScannerItemList->tail->data;
 
-               item->vhost = DupString(olditem->vhost);
+               item->vhost = xstrdup(olditem->vhost);
                item->fd = olditem->fd;
-               item->target_ip = DupString(olditem->target_ip);
+               item->target_ip = xstrdup(olditem->target_ip);
                item->target_port = olditem->target_port;
                item->timeout = olditem->timeout;
                item->max_read = olditem->max_read;
@@ -1930,9 +1930,9 @@ yyreduce:
        }
        else
        {
-          item->vhost = DupString("0.0.0.0");
+          item->vhost = xstrdup("0.0.0.0");
       item->fd = 512;
-      item->target_ip = DupString("127.0.0.1");
+      item->target_ip = xstrdup("127.0.0.1");
       item->target_port = 6667;
       item->timeout = 30;
       item->max_read = 4096;
@@ -1956,7 +1956,7 @@ yyreduce:
     {
    struct ScannerConf *item = (struct ScannerConf *) tmp;
    MyFree(item->name);
-   item->name = DupString((yyvsp[-1].string));
+   item->name = xstrdup((yyvsp[-1].string));
 }
 #line 1962 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1966,7 +1966,7 @@ yyreduce:
     {
    struct ScannerConf *item = (struct ScannerConf *) tmp;
    MyFree(item->vhost);
-   item->vhost = DupString((yyvsp[-1].string));
+   item->vhost = xstrdup((yyvsp[-1].string));
 }
 #line 1972 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -1976,7 +1976,7 @@ yyreduce:
     {
    struct ScannerConf *item = (struct ScannerConf *) tmp;
    MyFree(item->target_ip);
-   item->target_ip = DupString((yyvsp[-1].string));
+   item->target_ip = xstrdup((yyvsp[-1].string));
 }
 #line 1982 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -2060,7 +2060,7 @@ yyreduce:
 #line 525 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(OpmItem->dnsbl_from);
-   OpmItem->dnsbl_from = DupString((yyvsp[-1].string));
+   OpmItem->dnsbl_from = xstrdup((yyvsp[-1].string));
 }
 #line 2066 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -2069,7 +2069,7 @@ yyreduce:
 #line 531 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(OpmItem->dnsbl_to);
-   OpmItem->dnsbl_to = DupString((yyvsp[-1].string));
+   OpmItem->dnsbl_to = xstrdup((yyvsp[-1].string));
 }
 #line 2075 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -2078,7 +2078,7 @@ yyreduce:
 #line 537 "config-parser.y" /* yacc.c:1646  */
     {
    MyFree(OpmItem->sendmail);
-   OpmItem->sendmail = DupString((yyvsp[-1].string));
+   OpmItem->sendmail = xstrdup((yyvsp[-1].string));
 }
 #line 2084 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -2091,8 +2091,8 @@ yyreduce:
 
    item = MyMalloc(sizeof *item);
 
-   item->name = DupString("");
-   item->kline = DupString("");
+   item->name = xstrdup("");
+   item->kline = xstrdup("");
    item->ban_unknown = 0;
    item->type = A_BITMASK;
    item->reply = list_create();
@@ -2111,7 +2111,7 @@ yyreduce:
    struct BlacklistConf *item = tmp;
 
    MyFree(item->name);
-   item->name = DupString((yyvsp[-1].string));
+   item->name = xstrdup((yyvsp[-1].string));
 }
 #line 2117 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -2122,7 +2122,7 @@ yyreduce:
    struct BlacklistConf *item = tmp;
 
    MyFree(item->kline);
-   item->kline = DupString((yyvsp[-1].string));
+   item->kline = xstrdup((yyvsp[-1].string));
 }
 #line 2128 "config-parser.c" /* yacc.c:1646  */
     break;
@@ -2162,7 +2162,7 @@ yyreduce:
    item = MyMalloc(sizeof *item);
 
    item->number = (yyvsp[-3].number);
-   item->type = DupString((yyvsp[-1].string));
+   item->type = xstrdup((yyvsp[-1].string));
 
    node = node_create(item);
    list_add(blacklist->reply, node);
@@ -2174,7 +2174,7 @@ yyreduce:
 #line 637 "config-parser.y" /* yacc.c:1646  */
     {
    node_t *node;
-   node = node_create(DupString((yyvsp[-1].string)));
+   node = node_create(xstrdup((yyvsp[-1].string)));
 
    list_add(ExemptItem->masks, node);
 }
index fabdfadd22a52b0509574c6499161e94951ccca0..879be9ec220248a1051cc6273953e5ef05d03255 100644 (file)
@@ -147,7 +147,7 @@ options_negcache: NEGCACHE '=' timespec ';'
 options_pidfile: PIDFILE '=' STRING ';'
 {
    MyFree(OptionsItem->pidfile);
-   OptionsItem->pidfile = DupString($3);
+   OptionsItem->pidfile = xstrdup($3);
 };
 
 options_dns_fdlimit: DNS_FDLIMIT '=' NUMBER ';'
@@ -158,7 +158,7 @@ options_dns_fdlimit: DNS_FDLIMIT '=' NUMBER ';'
 options_scanlog: SCANLOG '=' STRING ';'
 {
    MyFree(OptionsItem->scanlog);
-   OptionsItem->scanlog = DupString($3);
+   OptionsItem->scanlog = xstrdup($3);
 };
 
 /*************************** IRC BLOCK ***************************/
@@ -188,49 +188,49 @@ irc_item: irc_away      |
 irc_away: AWAY '=' STRING ';'
 {
    MyFree(IRCItem->away);
-   IRCItem->away = DupString($3);
+   IRCItem->away = xstrdup($3);
 };
 
 irc_kline: KLINE '=' STRING ';'
 {
    MyFree(IRCItem->kline);
-   IRCItem->kline = DupString($3);
+   IRCItem->kline = xstrdup($3);
 };
 
 irc_mode: MODE '=' STRING ';'
 {
    MyFree(IRCItem->mode);
-   IRCItem->mode = DupString($3);
+   IRCItem->mode = xstrdup($3);
 };
 
 irc_nick: NICK '=' STRING ';'
 {
    MyFree(IRCItem->nick);
-   IRCItem->nick = DupString($3);
+   IRCItem->nick = xstrdup($3);
 };
 
 irc_nickserv: NICKSERV '=' STRING ';'
 {
    MyFree(IRCItem->nickserv);
-   IRCItem->nickserv = DupString($3);
+   IRCItem->nickserv = xstrdup($3);
 };
 
 irc_oper: OPER '=' STRING ';'
 {
    MyFree(IRCItem->oper);
-   IRCItem->oper = DupString($3);
+   IRCItem->oper = xstrdup($3);
 };
 
 irc_password: PASSWORD '=' STRING ';'
 {
    MyFree(IRCItem->password);
-   IRCItem->password = DupString($3);
+   IRCItem->password = xstrdup($3);
 };
 
 irc_perform: PERFORM '=' STRING ';'
 {
    node_t *node;
-   node = node_create(DupString($3));
+   node = node_create(xstrdup($3));
 
    list_add(IRCItem->performs, node);
 };
@@ -243,31 +243,31 @@ irc_port: PORT '=' NUMBER ';'
 irc_realname: REALNAME '=' STRING ';'
 {
    MyFree(IRCItem->realname);
-   IRCItem->realname = DupString($3);
+   IRCItem->realname = xstrdup($3);
 };
 
 irc_server: SERVER '=' STRING ';'
 {
    MyFree(IRCItem->server);
-   IRCItem->server = DupString($3);
+   IRCItem->server = xstrdup($3);
 };
 
 irc_username: USERNAME '=' STRING ';'
 {
    MyFree(IRCItem->username);
-   IRCItem->username = DupString($3);
+   IRCItem->username = xstrdup($3);
 };
 
 irc_vhost: VHOST '=' STRING ';'
 {
    MyFree(IRCItem->vhost);
-   IRCItem->vhost = DupString($3);
+   IRCItem->vhost = xstrdup($3);
 };
 
 irc_connregex: CONNREGEX '=' STRING ';'
 {
    MyFree(IRCItem->connregex);
-   IRCItem->connregex = DupString($3);
+   IRCItem->connregex = xstrdup($3);
 };
 
 
@@ -280,9 +280,9 @@ channel_entry:
 
    item = MyMalloc(sizeof *item);
 
-   item->name = DupString("");
-   item->key = DupString("");
-   item->invite = DupString("");
+   item->name = xstrdup("");
+   item->key = xstrdup("");
+   item->invite = xstrdup("");
 
    node = node_create(item);
    list_add(IRCItem->channels, node);
@@ -303,7 +303,7 @@ channel_name: NAME '=' STRING ';'
    struct ChannelConf *item = tmp;
 
    MyFree(item->name);
-   item->name = DupString($3);
+   item->name = xstrdup($3);
 };
 
 channel_key: KEY '=' STRING ';'
@@ -311,7 +311,7 @@ channel_key: KEY '=' STRING ';'
    struct ChannelConf *item = tmp;
 
    MyFree(item->key);
-   item->key = DupString($3);
+   item->key = xstrdup($3);
 };
 
 channel_invite: INVITE '=' STRING ';'
@@ -319,7 +319,7 @@ channel_invite: INVITE '=' STRING ';'
    struct ChannelConf *item = tmp;
 
    MyFree(item->invite);
-   item->invite = DupString($3);
+   item->invite = xstrdup($3);
 };
 
 /*************************** USER BLOCK ***************************/
@@ -353,7 +353,7 @@ user_mask: MASK '=' STRING ';'
    struct UserConf *item = (struct UserConf *) tmp;
 
    node_t *node;
-   node = node_create((void *) DupString($3));
+   node = node_create((void *) xstrdup($3));
 
    list_add(item->masks, node);
 };
@@ -363,7 +363,7 @@ user_scanner: SCANNER '=' STRING ';'
    struct UserConf *item = (struct UserConf *) tmp;
 
    node_t *node;
-   node = node_create((void *) DupString($3));
+   node = node_create((void *) xstrdup($3));
 
    list_add(item->scanners, node);
 };
@@ -378,15 +378,15 @@ scanner_entry:
    item = MyMalloc(sizeof *item);
 
    /* Setup ScannerConf defaults */
-   item->name = DupString("undefined");
+   item->name = xstrdup("undefined");
 
        if(LIST_SIZE(ScannerItemList) > 0)
        {
           olditem = ScannerItemList->tail->data;
 
-               item->vhost = DupString(olditem->vhost);
+               item->vhost = xstrdup(olditem->vhost);
                item->fd = olditem->fd;
-               item->target_ip = DupString(olditem->target_ip);
+               item->target_ip = xstrdup(olditem->target_ip);
                item->target_port = olditem->target_port;
                item->timeout = olditem->timeout;
                item->max_read = olditem->max_read;
@@ -396,9 +396,9 @@ scanner_entry:
        }
        else
        {
-          item->vhost = DupString("0.0.0.0");
+          item->vhost = xstrdup("0.0.0.0");
       item->fd = 512;
-      item->target_ip = DupString("127.0.0.1");
+      item->target_ip = xstrdup("127.0.0.1");
       item->target_port = 6667;
       item->timeout = 30;
       item->max_read = 4096;
@@ -434,21 +434,21 @@ scanner_name: NAME '=' STRING ';'
 {
    struct ScannerConf *item = (struct ScannerConf *) tmp;
    MyFree(item->name);
-   item->name = DupString($3);
+   item->name = xstrdup($3);
 };
 
 scanner_vhost: VHOST '=' STRING ';'
 {
    struct ScannerConf *item = (struct ScannerConf *) tmp;
    MyFree(item->vhost);
-   item->vhost = DupString($3);
+   item->vhost = xstrdup($3);
 };
 
 scanner_target_ip: TARGET_IP '=' STRING ';'
 {
    struct ScannerConf *item = (struct ScannerConf *) tmp;
    MyFree(item->target_ip);
-   item->target_ip = DupString($3);
+   item->target_ip = xstrdup($3);
 };
 
 scanner_target_string: TARGET_STRING '=' STRING ';'
@@ -524,19 +524,19 @@ opm_item: opm_dnsbl_from      |
 opm_dnsbl_from: DNSBL_FROM '=' STRING ';'
 {
    MyFree(OpmItem->dnsbl_from);
-   OpmItem->dnsbl_from = DupString($3);
+   OpmItem->dnsbl_from = xstrdup($3);
 };
 
 opm_dnsbl_to: DNSBL_TO '=' STRING ';'
 {
    MyFree(OpmItem->dnsbl_to);
-   OpmItem->dnsbl_to = DupString($3);
+   OpmItem->dnsbl_to = xstrdup($3);
 };
 
 opm_sendmail: SENDMAIL '=' STRING ';'
 {
    MyFree(OpmItem->sendmail);
-   OpmItem->sendmail = DupString($3);
+   OpmItem->sendmail = xstrdup($3);
 };
 
 /************************** BLACKLIST BLOCK *************************/
@@ -548,8 +548,8 @@ opm_blacklist_entry:
 
    item = MyMalloc(sizeof *item);
 
-   item->name = DupString("");
-   item->kline = DupString("");
+   item->name = xstrdup("");
+   item->kline = xstrdup("");
    item->ban_unknown = 0;
    item->type = A_BITMASK;
    item->reply = list_create();
@@ -575,14 +575,14 @@ blacklist_name: NAME '=' STRING ';' {
    struct BlacklistConf *item = tmp;
 
    MyFree(item->name);
-   item->name = DupString($3);
+   item->name = xstrdup($3);
 };
 
 blacklist_kline: KLINE '=' STRING ';' {
    struct BlacklistConf *item = tmp;
 
    MyFree(item->kline);
-   item->kline = DupString($3);
+   item->kline = xstrdup($3);
 };
 
 blacklist_type: TYPE '=' STRING ';' {
@@ -616,7 +616,7 @@ blacklist_reply_item: NUMBER '=' STRING ';'
    item = MyMalloc(sizeof *item);
 
    item->number = $1;
-   item->type = DupString($3);
+   item->type = xstrdup($3);
 
    node = node_create(item);
    list_add(blacklist->reply, node);
@@ -636,7 +636,7 @@ exempt_item: exempt_mask  |
 exempt_mask: MASK '=' STRING ';'
 {
    node_t *node;
-   node = node_create(DupString($3));
+   node = node_create(xstrdup($3));
 
    list_add(ExemptItem->masks, node);
 };
index 730d47276dba3bbfe9118fd988716e7d18e5ec9d..0a5c7719295f0ae87798e3aafdd073032a41d647 100644 (file)
@@ -117,34 +117,34 @@ void config_setup()
 {
 
    /* Setup IRC Block Defaults */
-   IRCItem->mode = DupString("+cs");
-   IRCItem->nick = DupString("hopm");
-   IRCItem->nickserv = DupString("");
-   IRCItem->password = DupString("");
+   IRCItem->mode = xstrdup("+cs");
+   IRCItem->nick = xstrdup("hopm");
+   IRCItem->nickserv = xstrdup("");
+   IRCItem->password = xstrdup("");
    IRCItem->port = 6667;
-   IRCItem->oper = DupString("undefined");
-   IRCItem->username = DupString("hopm");
-   IRCItem->realname = DupString("Hybrid Open Proxy Monitor");
-   IRCItem->server = DupString("myserver.blitzed.org");
-   IRCItem->vhost = DupString("");
-   IRCItem->connregex = DupString("\\*\\*\\* Notice -- Client connecting: ([^ ]+) \\(([^@]+)@([^\\)]+)\\) \\[([0-9\\.]+)\\].*");
-   IRCItem->kline = DupString("KLINE %u@%h :Open Proxy found on your host.");
+   IRCItem->oper = xstrdup("undefined");
+   IRCItem->username = xstrdup("hopm");
+   IRCItem->realname = xstrdup("Hybrid Open Proxy Monitor");
+   IRCItem->server = xstrdup("myserver.blitzed.org");
+   IRCItem->vhost = xstrdup("");
+   IRCItem->connregex = xstrdup("\\*\\*\\* Notice -- Client connecting: ([^ ]+) \\(([^@]+)@([^\\)]+)\\) \\[([0-9\\.]+)\\].*");
+   IRCItem->kline = xstrdup("KLINE %u@%h :Open Proxy found on your host.");
 
 
    /* Setup options block defaults */
    OptionsItem->negcache = 0;   /* 0 disabled negcache */
-   OptionsItem->pidfile = DupString("hopm.pid");
+   OptionsItem->pidfile = xstrdup("hopm.pid");
    OptionsItem->dns_fdlimit = 50;
    OptionsItem->scanlog = NULL;
 
    /* Setup OPM block defaults */
-   OpmItem->sendmail = DupString("/usr/sbin/sendmail");
-   OpmItem->dnsbl_from = DupString("");
-   OpmItem->dnsbl_to = DupString("");
+   OpmItem->sendmail = xstrdup("/usr/sbin/sendmail");
+   OpmItem->dnsbl_from = xstrdup("");
+   OpmItem->dnsbl_to = xstrdup("");
 }
 
 void yyerror(const char *str)
 {
-   log_printf("CONFIG -> %s: line %d, buf: %s", str, linenum,);
+   log_printf("CONFIG -> %s: line %d", str, linenum);
    exit(EXIT_FAILURE);
 }
index b56def06c53593344cfda3b15162a325803be022..7b42ed05b5b67edc7d84cc4ef4d56fc69db364d8 100644 (file)
--- a/src/irc.c
+++ b/src/irc.c
@@ -715,7 +715,7 @@ static struct UserInfo *userinfo_create(char *source)
    int i, len;
 
    nick = username = hostname = NULL;
-   tmp = DupString(source);
+   tmp = xstrdup(source);
    len = strlen(tmp);
 
    nick = tmp;
@@ -742,9 +742,9 @@ static struct UserInfo *userinfo_create(char *source)
 
    ret = MyMalloc(sizeof *ret);
 
-   ret->irc_nick     = DupString(nick);
-   ret->irc_username = DupString(username);
-   ret->irc_hostname = DupString(hostname);
+   ret->irc_nick     = xstrdup(nick);
+   ret->irc_username = xstrdup(username);
+   ret->irc_hostname = xstrdup(hostname);
 
    MyFree(tmp);
 
index a319c467d6a6b378276f04ba00d6b3548a6d1974..63b9c3139c1cc0391186b29f5f8dbf6e08518302 100644 (file)
@@ -69,14 +69,13 @@ void _MyFree(void **var)
    *var = NULL;
 }
 
-
-char *DupString(const char *y)
+void *
+xstrdup(const char *s)
 {
-   char *x;
+  void *ret = malloc(strlen(s) + 1);
 
-   x = malloc(strlen(y) + 1);
-   assert(x);
-   strcpy(x, y);
+  assert(ret);
+  strcpy(ret, s);
 
-   return x;
+  return ret;
 }
index 350e29c77e222c31d0bf97ec8cae9c3e8de94070..7eda24f30f2ca26373386fa0bbd8f3054594423c 100644 (file)
@@ -7,6 +7,6 @@
 
 extern void *MyMalloc(size_t bytes);
 extern void _MyFree(void **var);
-char *DupString(const char *y);
+extern void *xstrdup(const char *);
 
 #endif /* MALLOC_H */
index c9f57755a458e1817c2e0c93480a3008f667ff2e..02d67ac446a4455c3e65566091abe4e8190ccf6a 100644 (file)
@@ -231,11 +231,11 @@ static struct Command *command_create(unsigned short type, char *param, char *ir
    ret->type = type;
 
    if(param != NULL)
-      ret->param = DupString(param);
+      ret->param = xstrdup(param);
    else
       ret->param = NULL;
 
-   ret->irc_nick = (char *) DupString(irc_nick);
+   ret->irc_nick = xstrdup(irc_nick);
    ret->target = target; /* FIXME: This needs fixed if rehash is implemented */
 
    time(&(ret->added));
index 2abed0038a22d47495e257fc23cb08bb7f667e27..0e4993e5fd631999d9f910f2669ce4845235f408 100644 (file)
@@ -231,7 +231,7 @@ void scan_init()
 
       /* Build the scanner */
       scs->scanner = opm_create();
-      scs->name = (char *) DupString(sc->name);
+      scs->name = xstrdup(sc->name);
       scs->masks = list_create();
 
       /* Setup configuration */
@@ -301,7 +301,7 @@ void scan_init()
                            "[%s]", mask, scannername);
                   }
 
-                  node = node_create(DupString(mask));
+                  node = node_create(xstrdup(mask));
                   list_add(scs->masks, node);
                }
                break;
@@ -473,11 +473,11 @@ struct scan_struct *scan_create(char **user, char *msg)
 
    ss = MyMalloc(sizeof *ss);
 
-   ss->irc_nick = (char *) DupString(user[0]);
-   ss->irc_username = (char *) DupString(user[1]);
-   ss->irc_hostname = (char *) DupString(user[2]);
-   ss->ip = (char *) DupString(user[3]);
-   ss->proof = (char *) DupString(msg);
+   ss->irc_nick = xstrdup(user[0]);
+   ss->irc_username = xstrdup(user[1]);
+   ss->irc_hostname = xstrdup(user[2]);
+   ss->ip = xstrdup(user[3]);
+   ss->proof = xstrdup(msg);
 
    ss->remote = opm_remote_create(ss->ip);
    ss->scans = 0;
@@ -1027,7 +1027,7 @@ void scan_manual(char *param, struct ChannelConf *target)
    ss->irc_hostname = NULL;
    ss->proof        = NULL;
 
-   ss->ip = DupString(ip);
+   ss->ip = xstrdup(ip);
 
    ss->remote = opm_remote_create(ss->ip);
    ss->remote->data = ss;