You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/03/14 18:47:38 UTC

cvs commit: apache-2.0/src/lib/apr/misc/unix getopt.c start.c

rbb         00/03/14 09:47:38

  Modified:    src/lib/apr/include apr_general.h apr_getopt.h apr_lock.h
                        apr_portable.h
               src/lib/apr/locks/unix locks.c
               src/lib/apr/misc/unix getopt.c start.c
  Log:
  Fix more docs and change some parameter order on ap_getopt.  This makes
  ap_getopt look more like the rest of the apor functions.
  
  Revision  Changes    Path
  1.18      +6 -4      apache-2.0/src/lib/apr/include/apr_general.h
  
  Index: apr_general.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_general.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- apr_general.h	2000/03/10 00:06:09	1.17
  +++ apr_general.h	2000/03/14 17:47:36	1.18
  @@ -220,13 +220,15 @@
   
   
   /* Context functions */
  -ap_status_t ap_create_context(ap_context_t **, ap_context_t *);
  +ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont);
   ap_status_t ap_destroy_context(struct context_t *cont);
   ap_status_t ap_exit(ap_context_t *);
  -ap_status_t ap_set_userdata(void *, char *, 
  -                            ap_status_t (*cleanup) (void *), ap_context_t *);
  -ap_status_t ap_get_userdata(void **, char *, ap_context_t *);
  +ap_status_t ap_set_userdata(void *data, char *key, 
  +                            ap_status_t (*cleanup) (void *), 
  +                            ap_context_t *cont);
  +ap_status_t ap_get_userdata(void **, char *key, ap_context_t *cont);
   ap_status_t ap_initialize(void);
  +ap_status_t ap_set_abort(int (*apr_abort)(int retcode), ap_context_t *cont);
   
   #ifdef __cplusplus
   }
  
  
  
  1.4       +2 -2      apache-2.0/src/lib/apr/include/apr_getopt.h
  
  Index: apr_getopt.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_getopt.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- apr_getopt.h	2000/03/10 00:06:09	1.3
  +++ apr_getopt.h	2000/03/14 17:47:36	1.4
  @@ -64,8 +64,8 @@
   API_VAR_IMPORT char *
       ap_optarg;                          /* argument associated with option */
   
  -ap_status_t ap_getopt(ap_context_t *, ap_int32_t, char *const *, const char *,
  -                      ap_int32_t *);
  +ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, const char *ostr,
  +                      ap_int32_t *rv, ap_context_t *cont);
   
   #endif  /* ! APR_GETOPT_H */
   
  
  
  
  1.7       +10 -8     apache-2.0/src/lib/apr/include/apr_lock.h
  
  Index: apr_lock.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_lock.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- apr_lock.h	2000/03/10 00:06:09	1.6
  +++ apr_lock.h	2000/03/14 17:47:36	1.7
  @@ -70,15 +70,17 @@
   typedef struct lock_t           ap_lock_t;
   
   /*   Function definitions */
  -ap_status_t ap_create_lock(ap_lock_t **, ap_locktype_e, ap_lockscope_e, 
  -                           char *, ap_context_t *);
  -ap_status_t ap_lock(ap_lock_t *);
  -ap_status_t ap_unlock(ap_lock_t *);
  -ap_status_t ap_destroy_lock(ap_lock_t *);
  -ap_status_t ap_child_init_lock(ap_lock_t **, char *, ap_context_t *);
  +ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, 
  +                           ap_lockscope_e scope, char *fname, 
  +                           ap_context_t *cont);
  +ap_status_t ap_lock(ap_lock_t *lock);
  +ap_status_t ap_unlock(ap_lock_t *lock);
  +ap_status_t ap_destroy_lock(ap_lock_t *lock);
  +ap_status_t ap_child_init_lock(ap_lock_t **lock, char *fname, 
  +                               ap_context_t *cont);
   
  -ap_status_t ap_get_lockdata(ap_lock_t *, char *, void *);
  -ap_status_t ap_set_lockdata(ap_lock_t *, void *, char *,
  +ap_status_t ap_get_lockdata(ap_lock_t *lock, char *key, void *data);
  +ap_status_t ap_set_lockdata(ap_lock_t *lock, void *data, char *key,
                               ap_status_t (*cleanup) (void *));
   
   #ifdef __cplusplus
  
  
  
  1.24      +3 -2      apache-2.0/src/lib/apr/include/apr_portable.h
  
  Index: apr_portable.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_portable.h,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- apr_portable.h	2000/03/14 16:36:14	1.23
  +++ apr_portable.h	2000/03/14 17:47:36	1.24
  @@ -182,7 +182,7 @@
   ap_status_t ap_get_os_file(ap_os_file_t *thefile, ap_file_t *file);     
   ap_status_t ap_get_os_dir(ap_os_dir_t **thedir, ap_dir_t *dir);      
   ap_status_t ap_get_os_sock(ap_os_sock_t *, ap_socket_t *);
  -ap_status_t ap_get_os_lock(ap_os_lock_t *, ap_lock_t *);     
  +ap_status_t ap_get_os_lock(ap_os_lock_t *oslock, ap_lock_t *lock);     
   ap_status_t ap_get_os_proc(ap_os_proc_t *, ap_proc_t *);     
   ap_status_t ap_get_os_exp_time(ap_os_exp_time_t **, ap_exploded_time_t *);     
   ap_status_t ap_get_os_imp_time(ap_os_imp_time_t **, ap_time_t *);     
  @@ -196,7 +196,8 @@
   ap_status_t ap_put_os_dir(ap_dir_t **dir, ap_os_dir_t *thedir, 
                             ap_context_t *cont); 
   ap_status_t ap_put_os_sock(ap_socket_t **, ap_os_sock_t *, ap_context_t *);
  -ap_status_t ap_put_os_lock(ap_lock_t **, ap_os_lock_t *, ap_context_t *); 
  +ap_status_t ap_put_os_lock(ap_lock_t **lock, ap_os_lock_t *thelock, 
  +                           ap_context_t *cont); 
   ap_status_t ap_put_os_proc(ap_proc_t **, ap_os_proc_t *, ap_context_t *); 
   ap_status_t ap_put_os_imp_time(ap_time_t *, ap_os_imp_time_t **, ap_context_t *); 
   ap_status_t ap_put_os_exp_time(ap_exploded_time_t *, ap_os_exp_time_t **, ap_context_t *); 
  
  
  
  1.21      +22 -19    apache-2.0/src/lib/apr/locks/unix/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/unix/locks.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- locks.c	2000/03/10 04:15:39	1.20
  +++ locks.c	2000/03/14 17:47:37	1.21
  @@ -57,10 +57,11 @@
   #include "apr_portable.h"
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_create_lock(ap_context_t *, ap_locktype_e,
  - *                            ap_lockscope_e scope, char *, ap_lock_t **)
  + * ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type,
  + *                            ap_lockscope_e scope, char *fname, 
  + *                            ap_context_t *cont)
    *    Create a new instance of a lock structure. 
  - * arg 1) The context to operate on.
  + * arg 1) The newly created lock structure.
    * arg 2) The type of lock to create, one of:
    *            APR_MUTEX
    *            APR_READWRITE
  @@ -72,7 +73,7 @@
    * arg 4) A file name to use if the lock mechanism requires one.  This
    *        argument should always be provided.  The lock code itself will
    *        determine if it should be used.
  - * arg 5) The newly created lock structure.
  + * arg 5) The context to operate on.
    * NOTE:  APR_CROSS_PROCESS may lock both processes and threads, but it is
    *        only guaranteed to lock processes.
    */
  @@ -120,7 +121,7 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_lock(ap_lock_t *)
  + * ap_status_t ap_lock(ap_lock_t *lock)
    *    Lock a protected region. 
    * arg 1) The lock to set.
    */
  @@ -145,7 +146,7 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_unlock(ap_lock_t *)
  + * ap_status_t ap_unlock(ap_lock_t *lock)
    *    Unlock a protected region. 
    * arg 1) The lock to reset.
    */
  @@ -171,7 +172,7 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_destroy_lock(ap_lock_t *)
  + * ap_status_t ap_destroy_lock(ap_lock_t *lock)
    *    Free the memory associated with a lock. 
    * arg 1) The lock to free.
    * NOTE:  If the lock is currently active when it is destroyed, it 
  @@ -198,14 +199,15 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_child_init_lock(ap_lock_t **, ap_context_t *, char *)
  + * ap_status_t ap_child_init_lock(ap_lock_t **lock, char *fname, 
  + *                                ap_context_t *cont)
    *    Re-open a lock in a child process. 
  - * arg 1) The context to operate on.
  + * arg 1) The newly re-opened lock structure.
    * arg 2) A file name to use if the lock mechanism requires one.  This
    *        argument should always be provided.  The lock code itself will
    *        determine if it should be used.  This filename should be the same
    *        one that was passed to ap_create_lock
  - * arg 1) The newly re-opened lock structure.
  + * arg 3) The context to operate on.
    * NOTE:  This function doesn't always do something, it depends on the
    *        locking mechanism chosen for the platform, but it is a good
    *        idea to call it regardless, because it makes the code more
  @@ -223,7 +225,7 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_get_lockdata(ap_lock_t *, char *key, void *)
  + * ap_status_t ap_get_lockdata(ap_lock_t *lock, char *key, void *data)
    *    Return the context associated with the current lock.
    * arg 1) The currently open lock.
    * arg 2) The key to use when retreiving data associated with this lock
  @@ -241,7 +243,7 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_set_lockdata(ap_lock_t *, void *, char *,
  + * ap_status_t ap_set_lockdata(ap_lock_t *lock, void *data, char *key,
                                  ap_status_t (*cleanup) (void *))
    *    Return the context associated with the current lock.
    * arg 1) The currently open lock.
  @@ -262,10 +264,10 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_get_os_lock(ap_os_lock_t *, ap_lock_t **)
  + * ap_status_t ap_get_os_lock(ap_os_lock_t *oslock, ap_lock_t *lock)
    *    onvert the lock from os specific type to apr type
  - * arg 1) The apr lock to convert.
  - * arg 2) The os specific lock we are converting to.
  + * arg 1) The os specific lock we are converting to.
  + * arg 2) The apr lock to convert.
    */
   ap_status_t ap_get_os_lock(ap_os_lock_t *oslock, struct lock_t *lock)
   {
  @@ -283,11 +285,12 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_put_os_lock(ap_lock_t **, ap_os_lock_t *, ap_context_t *)
  + * ap_status_t ap_put_os_lock(ap_lock_t **lock, ap_os_lock_t *,
  + *                            ap_context_t *cont)
    *    onvert the lock from os specific type to apr type
  - * arg 1) The context to use if it is needed.
  - * arg 2) The apr lock we are converting to.
  - * arg 3) The os specific lock to convert.
  + * arg 1) The apr lock we are converting to.
  + * arg 2) The os specific lock to convert.
  + * arg 3) The context to use if it is needed.
    */
   ap_status_t ap_put_os_lock(struct lock_t **lock, ap_os_lock_t *thelock, 
                              ap_context_t *cont)
  
  
  
  1.4       +8 -9      apache-2.0/src/lib/apr/misc/unix/getopt.c
  
  Index: getopt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/unix/getopt.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- getopt.c	1999/12/03 15:18:30	1.3
  +++ getopt.c	2000/03/14 17:47:37	1.4
  @@ -42,26 +42,25 @@
   #define EMSG    ""
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_getopt(ap_context_t *, ap_int32_t, char *const *, 
  - *                       const char *, ap_int32_t)
  + * ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, 
  + *                       const char *ostr, ap_int32_t *rv, ap_context_t *cont)
    *    Parse the command line options passed to the program.
  - * arg 1) The context to operate on.
  - * arg 2) The number of arguments passed to ap_getopt to parse
  - * arg 3) The array of command line options to parse
  - * arg 4) A string of characters that are acceptable options to the program.
  + * arg 1) The number of arguments passed to ap_getopt to parse
  + * arg 2) The array of command line options to parse
  + * arg 3) A string of characters that are acceptable options to the program.
    *        characters followed by ":" are required to have an option 
    *        associated 
  - * arg 5) The next option found.  There are four potential values for 
  + * arg 4) The next option found.  There are four potential values for 
    *        this variable on exit. They are:
    *            APR_EOF    --  No more options to parse
    *            APR_BADCH  --  Found a bad option character
    *            APR_BADARG --  Missing parameter for the found option
    *            Other      --  The next option found.
  + * arg 5) The context to operate on.
    * NOTE:  Arguments 2 and 3 are most commonly argc and argv from 
    *        main(argc, argv)
    */
  -ap_status_t ap_getopt(struct context_t *cont, ap_int32_t nargc, 
  -                      char *const *nargv, const char *ostr, ap_int32_t *rv)
  +ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, const char *ostr, ap_int32_t *rv, struct context_t *cont)
   {
       char *p;
       static char *place = EMSG;   /* option letter processing */
  
  
  
  1.20      +26 -15    apache-2.0/src/lib/apr/misc/unix/start.c
  
  Index: start.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/unix/start.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- start.c	2000/03/10 00:06:20	1.19
  +++ start.c	2000/03/14 17:47:38	1.20
  @@ -57,13 +57,13 @@
   #include "../../locks/unix/locks.h"
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_create_context(ap_context_t **, ap_context_t *)
  + * ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont)
    *    Create a new context.
  - * arg 1) The parent context.  If this is NULL, the new context is a root
  + * arg 1) The context we have just created.
  + * arg 2) The parent context.  If this is NULL, the new context is a root
    *        context.  If it is non-NULL, the new context will inherit all
    *        of it's parent context's attributes, except the ap_context_t will be a
    *        sub-pool.
  - * arg 2) The context we have just created.
    */
   ap_status_t ap_create_context(struct context_t **newcont, struct context_t *cont)
   {
  @@ -92,7 +92,7 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_destroy_context(ap_context_t *)
  + * ap_status_t ap_destroy_context(ap_context_t *cont)
    *    Free the context and all of it's child contexts'.
    * arg 1) The context to free.
    */
  @@ -103,13 +103,14 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_set_userdata(ap_context_t *, void *, char *,
  -                               ap_status_t (*cleanup) (void *))
  + * ap_status_t ap_set_userdata(void *data, char *key, 
  + *                             ap_status_t (*cleanup) (void *),
  + *                             ap_context_t *cont)
    *    Set the data associated with the current context.
  - * arg 1) The current context.
  - * arg 2) The user data associated with the context.
  - * arg 3) The key to use for association
  - * arg 4) The cleanup program to use to cleanup the data;
  + * arg 1) The user data associated with the context.
  + * arg 2) The key to use for association
  + * arg 3) The cleanup program to use to cleanup the data;
  + * arg 4) The current context.
    * NOTE:  The data to be attached to the context should have the same
    *        life span as the context it is being attached to.
    *        
  @@ -152,11 +153,11 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_get_userdata(void **, ap_context_t *)
  + * ap_status_t ap_get_userdata(void **data, char *key, ap_context_t *cont)
    *    Return the data associated with the current context.
  - * arg 1) The current context.
  - * arg 2) The key for the data to retrieve
  - * arg 3) The user data associated with the context.
  + * arg 1) The key for the data to retrieve
  + * arg 2) The user data associated with the context.
  + * arg 3) The current context.
    */
   ap_status_t ap_get_userdata(void **data, char *key, struct context_t *cont)
   {
  @@ -181,7 +182,7 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_initialize()
  + * ap_status_t ap_initialize(void)
    *    Setup any APR internal data structures.  This MUST be the first
    *    function called for any APR program.
    */
  @@ -191,6 +192,16 @@
       return APR_SUCCESS;
   }
   
  +/* ***APRDOC********************************************************
  + * ap_status_t ap_set_abort(int (*apr_abort)(int retcode), ap_context_t *cont)
  + *    Set the APR_ABORT function.
  + * NOTE:  This is in for backwards compatability.  If the program using
  + *        APR wants APR to exit on a memory allocation error, then this
  + *        function should be called to set the function to use in order
  + *        to actually exit the program.  If this function is not called,
  + *        then APR will return an error and expect the calling program to
  + *        deal with the error accordingly.
  + */
   ap_status_t ap_set_abort(int (*apr_abort)(int retcode), struct context_t *cont)
   {
       if (cont == NULL) {