apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: apr-util/include apr_optional_hooks.h apr_generic_hook.h
Date Sun, 20 May 2001 12:45:54 GMT
ben         01/05/20 05:45:54

  Modified:    modules/experimental config.m4
               include  apr_sms.h
               hooks    apr_hooks.c
  Added:       modules/experimental mod_optional_hook_export.c
                        mod_optional_hook_export.h
                        mod_optional_hook_import.c
               include  apr_optional_hooks.h
  Removed:     modules/experimental mod_generic_hook_export.c
                        mod_generic_hook_export.h mod_generic_hook_import.c
               include  apr_generic_hook.h
  Log:
  Long overdue name change from "generic hook" to "optional hook".
  
  Revision  Changes    Path
  1.10      +2 -2      httpd-2.0/modules/experimental/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/config.m4,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- config.m4	2001/05/06 17:08:06	1.9
  +++ config.m4	2001/05/20 12:45:49	1.10
  @@ -7,8 +7,8 @@
   APACHE_MODULE(ext_filter, external filter module, , , no)
   APACHE_MODULE(case_filter, example uppercase conversion filter, , , no)
   APACHE_MODULE(case_filter_in, example uppercase conversion input filter, , , no)
  -APACHE_MODULE(generic_hook_export, example hook exporter, , , no)
  -APACHE_MODULE(generic_hook_import, example hook importer, , , no)
  +APACHE_MODULE(optional_hook_export, example optional hook exporter, , , no)
  +APACHE_MODULE(optional_hook_import, example optional hook importer, , , no)
   APACHE_MODULE(optional_fn_import, example optional function importer, , , no)
   APACHE_MODULE(optional_fn_export, example optional function exporter, , , no)
   
  
  
  
  1.1                  httpd-2.0/modules/experimental/mod_optional_hook_export.c
  
  Index: mod_optional_hook_export.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "httpd.h"
  #include "http_config.h"
  #include "mod_optional_hook_export.h"
  #include "http_protocol.h"
  
  APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP_MODULE,int,generic_hook_test,
  				    (const char *szStr),
  				    (szStr),OK,DECLINED)
  
  static int ExportLogTransaction(request_rec *r)
  {
      return ap_run_generic_hook_test(r->the_request);
  }
  
  static void ExportRegisterHooks(apr_pool_t *p)
  {
      ap_hook_log_transaction(ExportLogTransaction,NULL,NULL,APR_HOOK_MIDDLE);
  }
  
  module optional_hook_export_module =
  {
      STANDARD20_MODULE_STUFF,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      ExportRegisterHooks
  };
  
  
  
  1.1                  httpd-2.0/modules/experimental/mod_optional_hook_export.h
  
  Index: mod_optional_hook_export.h
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #ifndef MOD_GENERIC_HOOK_EXPORT_H
  #define MOD_GENERIC_HOOK_EXPORT_H
  
  #include "apr_optional_hooks.h"
  
  APR_DECLARE_EXTERNAL_HOOK(ap,AP_MODULE,int,generic_hook_test,(const char *))
  
  #endif /* def MOD_GENERIC_HOOK_EXPORT_H */
  
  
  
  1.1                  httpd-2.0/modules/experimental/mod_optional_hook_import.c
  
  Index: mod_optional_hook_import.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "httpd.h"
  #include "http_config.h"
  #include "http_log.h"
  #include "mod_optional_hook_export.h"
  
  static int ImportGenericHookTestHook(const char *szStr)
  {
      ap_log_error(APLOG_MARK,APLOG_ERR,OK,NULL,"Generic hook test said: %s",
  		 szStr);
  
      return OK;
  }
  
  static void ImportRegisterHooks(apr_pool_t *p)
  {
      APR_OPTIONAL_HOOK(ap,generic_hook_test,ImportGenericHookTestHook,NULL,NULL,
  		      APR_HOOK_MIDDLE);
  }
  
  module optional_hook_import_module=
  {
      STANDARD20_MODULE_STUFF,
      NULL,
      NULL,
      NULL,
      NULL,
      NULL,
      ImportRegisterHooks
  };
  
  
  
  1.5       +0 -2      apr/include/apr_sms.h
  
  Index: apr_sms.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_sms.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- apr_sms.h	2001/05/19 22:47:29	1.4
  +++ apr_sms.h	2001/05/20 12:45:51	1.5
  @@ -214,7 +214,6 @@
   /**
    * Perform thread-safe locking required whilst this memory system is modified
    * @param mem_sys The memory system to be locked for thread-safety
  - * @deffunc void apr_sms_lock(apr_sms_t *mem_sys)
    */
   APR_DECLARE(apr_status_t) apr_sms_lock(apr_sms_t *mem_sys);
   
  @@ -222,7 +221,6 @@
    * Release thread-safe locking required whilst this memory system was
    * being modified
    * @param mem_sys The memory system to be released from thread-safety
  - * @deffunc void apr_sms_unlock(apr_sms_t *mem_sys)
    */
   APR_DECLARE(apr_status_t) apr_sms_unlock(apr_sms_t *mem_sys);
   
  
  
  
  1.40      +18 -17    apr-util/hooks/apr_hooks.c
  
  Index: apr_hooks.c
  ===================================================================
  RCS file: /home/cvs/apr-util/hooks/apr_hooks.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- apr_hooks.c	2001/04/05 09:08:48	1.39
  +++ apr_hooks.c	2001/05/20 12:45:52	1.40
  @@ -61,7 +61,7 @@
   #include "apr.h"
   #include "apr_hooks.h"
   #include "apr_hash.h"
  -#include "apr_generic_hook.h"
  +#include "apr_optional_hooks.h"
   #include "apr_optional.h"
   
   #if APR_HAVE_STRINGS_H
  @@ -237,7 +237,7 @@
       }
   }
       
  -static apr_hash_t *s_phGenericHooks;
  +static apr_hash_t *s_phOptionalHooks;
   static apr_hash_t *s_phOptionalFunctions;
   
   APU_DECLARE(void) apr_hook_deregister_all(void)
  @@ -249,7 +249,7 @@
           *pEntry->paHooks=NULL;
       }
       s_aHooksToSort=NULL;
  -    s_phGenericHooks=NULL;
  +    s_phOptionalHooks=NULL;
       s_phOptionalFunctions=NULL;
   }
   
  @@ -286,38 +286,39 @@
       fputc('\n',stdout);
   }
   
  -/* Generic hook support */
  +/* Optional hook support */
   
  -APR_DECLARE_EXTERNAL_HOOK(apr,APU,void,_generic,(void))
  +APR_DECLARE_EXTERNAL_HOOK(apr,APU,void,_optional,(void))
   
  -APU_DECLARE(apr_array_header_t *) apr_hook_generic_get(const char *szName)
  +APU_DECLARE(apr_array_header_t *) apr_optional_hook_get(const char *szName)
   {
       apr_array_header_t **ppArray;
   
  -    if(!s_phGenericHooks)
  +    if(!s_phOptionalHooks)
   	return NULL;
  -    ppArray=apr_hash_get(s_phGenericHooks,szName,strlen(szName));
  +    ppArray=apr_hash_get(s_phOptionalHooks,szName,strlen(szName));
       if(!ppArray)
   	return NULL;
       return *ppArray;
   }
   
  -APU_DECLARE(void) apr_hook_generic_add(const char *szName,void (*pfn)(void),
  -				  const char * const *aszPre,
  -				  const char * const *aszSucc,int nOrder)
  +APU_DECLARE(void) apr_optional_hook_add(const char *szName,void (*pfn)(void),
  +					const char * const *aszPre,
  +					const char * const *aszSucc,int nOrder)
   {
  -    apr_array_header_t *pArray=apr_hook_generic_get(szName);
  -    apr_LINK__generic_t *pHook;
  +    apr_array_header_t *pArray=apr_optional_hook_get(szName);
  +    apr_LINK__optional_t *pHook;
   
       if(!pArray) {
   	apr_array_header_t **ppArray;
   
  -	pArray=apr_array_make(apr_global_hook_pool,1,sizeof(apr_LINK__generic_t));
  -	if(!s_phGenericHooks)
  -	    s_phGenericHooks=apr_hash_make(apr_global_hook_pool);
  +	pArray=apr_array_make(apr_global_hook_pool,1,
  +			      sizeof(apr_LINK__optional_t));
  +	if(!s_phOptionalHooks)
  +	    s_phOptionalHooks=apr_hash_make(apr_global_hook_pool);
   	ppArray=apr_palloc(apr_global_hook_pool,sizeof *ppArray);
   	*ppArray=pArray;
  -	apr_hash_set(s_phGenericHooks,szName,strlen(szName),ppArray);
  +	apr_hash_set(s_phOptionalHooks,szName,strlen(szName),ppArray);
   	apr_hook_sort_register(szName,ppArray);
       }
       pHook=apr_array_push(pArray);
  
  
  
  1.1                  apr-util/include/apr_optional_hooks.h
  
  Index: apr_optional_hooks.h
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #ifndef APR_OPTIONAL_HOOK_H
  #define APR_OPTIONAL_HOOK_H
  
  #include "apr_tables.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
  /**
   * @package Apache optional hook functions
   */
  
  APU_DECLARE(void) apr_optional_hook_add(const char *szName,void (*pfn)(void),
  					const char * const *aszPre,
  					const char * const *aszSucc,
  					int nOrder);
  
  /**
   * Hook to an optional hook.
   *
   * @param name The name of the hook
   * @param pfn A pointer to a function that will be called
   * @param aszPre a NULL-terminated array of strings that name modules whose hooks should
precede this one
   * @param aszSucc a NULL-terminated array of strings that name modules whose hooks should
succeed this one
   * @param nOrder an integer determining order before honouring aszPre and aszSucc (for example
HOOK_MIDDLE)
   */
  
  #define APR_OPTIONAL_HOOK(ns,name,pfn,aszPre,aszSucc,nOrder) \
      ((void (*)(const char *,ns##_HOOK_##name##_t *,const char * const *, \
  	       const char * const *,int))&apr_optional_hook_add)(#name,pfn,aszPre, \
  							   aszSucc, nOrder)
  
  APU_DECLARE(apr_array_header_t *) apr_optional_hook_get(const char *szName);
  
  /**
   * Implement an optional hook that runs until one of the functions
   * returns something other than OK or DECLINE.
   *
   * @param ret The type of the return value of the hook
   * @param name The name of the hook
   * @param args_decl The declaration of the arguments for the hook
   * @param args_used The names for the arguments for the hook
   */
  #define APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ns,link,ret,name,args_decl,args_use,ok,decline)
\
  link##_DECLARE(ret) ns##_run_##name args_decl \
      { \
      ns##_LINK_##name##_t *pHook; \
      int n; \
      ret rv; \
      apr_array_header_t *pHookArray=apr_optional_hook_get(#name); \
  \
      if(!pHookArray) \
  	return ok; \
  \
      pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \
      for(n=0 ; n < pHookArray->nelts ; ++n) \
  	{ \
  	rv=(pHook[n].pFunc)args_use; \
  \
  	if(rv != ok && rv != decline) \
  	    return rv; \
  	} \
      return ok; \
      }
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif /* APR_OPTIONAL_HOOK_H */
  
  
  

Mime
View raw message