* use the const str type libcitadel gives us, instead of roling our own.
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 3 Oct 2010 19:34:35 +0000 (21:34 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 3 Oct 2010 19:34:35 +0000 (21:34 +0200)
webcit/inetconf.c

index a19c4fbd70079cd871cbe981a862775f38e2e78c..51fcc946f7eabd4b23c3eda992919d1470b9f07c 100644 (file)
@@ -19,14 +19,9 @@ typedef enum _e_cfg {
        ic_max
 } ECfg;
 
-typedef struct _ConstStrBuf {
-       const char *name;
-       size_t len;
-} ConstStrBuf;
-
 
   /* These are server config keywords; do not localize! */
-ConstStrBuf CfgNames[] = {
+ConstStr CfgNames[] = {
        { HKEY("localhost") },
        { HKEY("directory") },
        { HKEY("smarthost") },
@@ -55,9 +50,9 @@ void load_inetconf(void)
        
        WCC->InetCfg = NewHash(1, NULL);
 
-       for (i = 0; i < (sizeof(CfgNames) / sizeof(ConstStrBuf)); i++) {
+       for (i = 0; i < (sizeof(CfgNames) / sizeof(ConstStr)); i++) {
                Hash = NewHash(1, NULL);
-               Put(WCC->InetCfg, CfgNames[i].name, CfgNames[i].len, Hash, HDeleteHash);
+               Put(WCC->InetCfg, CKEY(CfgNames[i]), Hash, HDeleteHash);
        }
 
        serv_printf("CONF GETSYS|application/x-citadel-internet-config");
@@ -150,12 +145,12 @@ void new_save_inetconf(void) {
        serv_printf("CONF PUTSYS|application/x-citadel-internet-config");
        StrBuf_ServGetln(Buf);
        if (GetServerStatus(Buf, NULL) == 4) {
-               for (i = 0; i < (sizeof(CfgNames) / sizeof(ConstStrBuf)); i++) {
+               for (i = 0; i < (sizeof(CfgNames) / sizeof(ConstStr)); i++) {
                        HashPos *where;
                        const char *Key;
                        long KeyLen;
 
-                       GetHash(WCC->InetCfg, CfgNames[i].name, CfgNames[i].len, &vHash);
+                       GetHash(WCC->InetCfg, CKEY(CfgNames[i]), &vHash);
                        Hash = (HashList*) vHash;
                        if (Hash == NULL) {
                                sprintf(WC->ImportantMessage, _("Invalid Parameter"));
@@ -169,7 +164,7 @@ void new_save_inetconf(void) {
                                        if ((Str!= NULL) && (StrLength(Str) > 0))
                                                serv_printf("%s|%s", 
                                                            ChrPtr(Str),
-                                                           CfgNames[i].name); 
+                                                           CfgNames[i].Key); 
                                }
                                DeleteHashPos(&where);
                        }