apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@locus.apache.org
Subject cvs commit: apr/test testargs.c
Date Wed, 29 Nov 2000 07:41:27 GMT
gstein      00/11/28 23:41:27

  Modified:    include  apr_getopt.h
               misc/unix getopt.c
               test     testargs.c
  Log:
  Add an extra const into the getopt functions. We never attempt to modify any
  of the data, so the const is proper. This also allows clients to pass const
  data in.
  
  Revision  Changes    Path
  1.27      +1 -1      apr/include/apr_getopt.h
  
  Index: apr_getopt.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_getopt.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -u -r1.26 -r1.27
  --- apr_getopt.h	2000/11/26 03:00:01	1.26
  +++ apr_getopt.h	2000/11/29 07:41:26	1.27
  @@ -110,7 +110,7 @@
    * @deffunc apr_status_t apr_initopt(apr_getopt_t **os, apr_pool_t *cont,int argc, char
*const *argv)
    */
   APR_DECLARE(apr_status_t) apr_initopt(apr_getopt_t **os, apr_pool_t *cont,
  -                                      int argc, char *const *argv);
  +                                      int argc, const char *const *argv);
   
   /**
    * Parse the options initialized by apr_initopt().
  
  
  
  1.28      +4 -6      apr/misc/unix/getopt.c
  
  Index: getopt.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/unix/getopt.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -u -r1.27 -r1.28
  --- getopt.c	2000/11/25 05:52:17	1.27
  +++ getopt.c	2000/11/29 07:41:27	1.28
  @@ -49,10 +49,8 @@
   }
   
   APR_DECLARE(apr_status_t) apr_initopt(apr_getopt_t **os, apr_pool_t *cont,
  -                                     int argc, char *const *argv)
  +                                      int argc, const char *const *argv)
   {
  -    int i;
  -
       *os = apr_palloc(cont, sizeof(apr_getopt_t));
       (*os)->cont = cont;
       (*os)->err = 1;
  @@ -64,19 +62,19 @@
          want to use this function with arrays other than the main argv,
          and we shouldn't touch the caller's data.  So we copy. */
       (*os)->argv = apr_palloc(cont, (argc + 1) * sizeof(const char *));
  -    for (i = 0; i < argc; i++)
  -	(*os)->argv[i] = argv[i];
  +    memcpy((*os)->argv, argv, argc * sizeof(const char *));
       (*os)->argv[argc] = NULL;
   
       (*os)->interleave = 0;
       (*os)->ind = 1;
       (*os)->skip_start = 1;
       (*os)->skip_end = 1;
  +
       return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, 
  -                                    char *optch, const char **optarg)
  +                                     char *optch, const char **optarg)
   {
       const char *oli;  /* option letter list index */
   
  
  
  
  1.17      +1 -1      apr/test/testargs.c
  
  Index: testargs.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testargs.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -u -r1.16 -r1.17
  --- testargs.c	2000/11/25 22:34:04	1.16
  +++ testargs.c	2000/11/29 07:41:27	1.17
  @@ -73,7 +73,7 @@
       }
   }
   
  -int main(int argc, char * const argv[])
  +int main(int argc, const char * const argv[])
   {
       apr_pool_t *context;
       apr_getopt_t *opt;
  
  
  

Mime
View raw message