current loadcfg.c,1.155,1.156

Fabian Keil <[email protected]> Fri, 24 Feb 2017 11:59:47 +0000
Newsgroups gmane.comp.web.privoxy.cvs
Message-ID <[email protected]>
Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18634

Modified Files:
	loadcfg.c 
Log Message:
Consistently use strdup_or_die() instead of strdup()

Allocation failures aren't expected here and using strdup_or_die()
allows to remove a couple of explicit error checks which slightly
reduces the size of the binary.


Index: loadcfg.c
===================================================================
RCS file: /cvsroot/ijbswa/current/loadcfg.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -C2 -d -r1.155 -r1.156
*** loadcfg.c	20 Feb 2017 13:44:32 -0000	1.155
--- loadcfg.c	24 Feb 2017 11:59:44 -0000	1.156
***************
*** 598,603 ****
     config->multi_threaded            = 1;
     config->buffer_limit              = 4096 * 1024;
!    config->usermanual                = strdup(USER_MANUAL_URL);
!    config->proxy_args                = strdup("");
     config->forwarded_connect_retries = 0;
  #ifdef FEATURE_CLIENT_TAGS
--- 598,603 ----
     config->multi_threaded            = 1;
     config->buffer_limit              = 4096 * 1024;
!    config->usermanual                = strdup_or_die(USER_MANUAL_URL);
!    config->proxy_args                = strdup_or_die("");
     config->forwarded_connect_retries = 0;
  #ifdef FEATURE_CLIENT_TAGS
***************
*** 713,717 ****
                    MAX_AF_FILES);
              }
!             config->actions_file_short[i] = strdup(arg);
              config->actions_file[i] = make_path(config->confdir, arg);
  
--- 713,717 ----
                    MAX_AF_FILES);
              }
!             config->actions_file_short[i] = strdup_or_die(arg);
              config->actions_file[i] = make_path(config->confdir, arg);
  
***************
*** 736,740 ****
           case hash_admin_address :
              freez(config->admin_address);
!             config->admin_address = strdup(arg);
              break;
  
--- 736,740 ----
           case hash_admin_address :
              freez(config->admin_address);
!             config->admin_address = strdup_or_die(arg);
              break;
  
***************
*** 1081,1085 ****
                    MAX_AF_FILES);
              }
!             config->re_filterfile_short[i] = strdup(arg);
              config->re_filterfile[i] = make_path(config->confdir, arg);
  
--- 1081,1085 ----
                    MAX_AF_FILES);
              }
!             config->re_filterfile_short[i] = strdup_or_die(arg);
              config->re_filterfile[i] = make_path(config->confdir, arg);
  
***************
*** 1304,1312 ****
           case hash_hostname :
              freez(config->hostname);
!             config->hostname = strdup(arg);
!             if (NULL == config->hostname)
!             {
!                log_error(LOG_LEVEL_FATAL, "Out of memory saving hostname.");
!             }
              break;
  
--- 1304,1308 ----
           case hash_hostname :
              freez(config->hostname);
!             config->hostname = strdup_or_die(arg);
              break;
  
***************
*** 1347,1355 ****
                    MAX_LISTENING_SOCKETS);
              }
!             config->haddr[i] = strdup(arg);
!             if (NULL == config->haddr[i])
!             {
!                log_error(LOG_LEVEL_FATAL, "Out of memory while copying listening address");
!             }
              break;
  
--- 1343,1347 ----
                    MAX_LISTENING_SOCKETS);
              }
!             config->haddr[i] = strdup_or_die(arg);
              break;
  
***************
*** 1503,1507 ****
           case hash_proxy_info_url :
              freez(config->proxy_info_url);
!             config->proxy_info_url = strdup(arg);
              break;
  
--- 1495,1499 ----
           case hash_proxy_info_url :
              freez(config->proxy_info_url);
!             config->proxy_info_url = strdup_or_die(arg);
              break;
  
***************
*** 1634,1638 ****
               */
              freez(config->usermanual);
!             config->usermanual = strdup(arg);
              break;
  
--- 1626,1630 ----
               */
              freez(config->usermanual);
!             config->usermanual = strdup_or_die(arg);
              break;
  
***************
*** 1876,1884 ****
     if (NULL == config->haddr[0])
     {
!       config->haddr[0] = strdup(HADDR_DEFAULT);
!       if (NULL == config->haddr[0])
!       {
!          log_error(LOG_LEVEL_FATAL, "Out of memory while copying default listening address");
!       }
     }
  
--- 1868,1872 ----
     if (NULL == config->haddr[0])
     {
!       config->haddr[0] = strdup_or_die(HADDR_DEFAULT);
     }
  
***************
*** 2028,2032 ****
      * link to its section in the user-manual
      */
!    buf = strdup("\n<a href=\"");
     if (!strncmpic(config->usermanual, "file://", 7) ||
         !strncmpic(config->usermanual, "http", 4))
--- 2016,2020 ----
      * link to its section in the user-manual
      */
!    buf = strdup_or_die("\n<a href=\"");
     if (!strncmpic(config->usermanual, "file://", 7) ||
         !strncmpic(config->usermanual, "http", 4))


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot