tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_map.h
Date Thu, 25 Apr 2002 19:16:14 GMT
costin      02/04/25 12:16:14

  Modified:    jk/native2/common jk_map.c
               jk/native2/include jk_map.h
  Log:
  Update rc. Added 2 debug fields - so we can see the content of the
  map in gdb.
  
  Revision  Changes    Path
  1.18      +24 -22    jakarta-tomcat-connectors/jk/native2/common/jk_map.c
  
  Index: jk_map.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_map.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- jk_map.c	20 Apr 2002 22:57:16 -0000	1.17
  +++ jk_map.c	25 Apr 2002 19:16:14 -0000	1.18
  @@ -58,7 +58,7 @@
   /***************************************************************************
    * Description: General purpose map object                                 *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
  - * Version:     $Revision: 1.17 $                                           *
  + * Version:     $Revision: 1.18 $                                           *
    ***************************************************************************/
   
   #include "jk_global.h"
  @@ -103,12 +103,12 @@
                                  const char *name, void *value,
                                  void **old)
   {
  -    int rc = JK_FALSE;
  +    int rc = JK_ERR;
       int i;
       jk_map_private_t *mPriv;
   
       if( name==NULL ) 
  -        return JK_FALSE;
  +        return JK_ERR;
   
       mPriv=(jk_map_private_t *)m->_private;
       
  @@ -123,7 +123,7 @@
           if( old!=NULL )
               *old = (void *) mPriv->values[i]; /* DIRTY */
           mPriv->values[i] = value;
  -        return JK_TRUE;
  +        return JK_OK;
       }
       
       jk2_map_default_realloc(env, m);
  @@ -138,7 +138,7 @@
           */
           mPriv->names[mPriv->size] = m->pool->pstrdup(env,m->pool, name);
           mPriv->size ++;
  -        rc = JK_TRUE;
  +        rc = JK_OK;
       }
       return rc;
   }
  @@ -146,11 +146,11 @@
   static int jk2_map_default_add(jk_env_t *env, jk_map_t *m,
                                  const char *name, void *value)
   {
  -    int rc = JK_FALSE;
  +    int rc = JK_ERR;
       jk_map_private_t *mPriv;
   
       if( name==NULL ) 
  -        return JK_FALSE;
  +        return JK_ERR;
   
       mPriv=(jk_map_private_t *)m->_private;
       
  @@ -165,7 +165,7 @@
           /*     mPriv->names[mPriv->size] = m->pool->pstrdup(m->pool, name);
*/
           mPriv->names[mPriv->size] =  (char *)name; 
           mPriv->size ++;
  -        rc = JK_TRUE;
  +        rc = JK_OK;
       }
       return rc;
   }
  @@ -232,11 +232,11 @@
   
           if( dst->get(env, dst, name ) == NULL) {
               int rc= dst->put(env, dst, name, value, NULL );
  -            if( rc != JK_TRUE )
  +            if( rc != JK_OK )
                   return rc;
           }
       }
  -    return JK_TRUE;
  +    return JK_OK;
   }
                                  
   /* ==================== */
  @@ -249,14 +249,14 @@
       jk_map_private_t *mPriv;
   
       if( m== NULL )
  -        return JK_FALSE;
  +        return JK_ERR;
       
  -    _this=(jk_map_t *)pool->alloc(env, pool, sizeof(jk_map_t));
  -    mPriv=(jk_map_private_t *)pool->alloc(env, pool, sizeof(jk_map_private_t));
  +    _this=(jk_map_t *)pool->calloc(env, pool, sizeof(jk_map_t));
  +    mPriv=(jk_map_private_t *)pool->calloc(env, pool, sizeof(jk_map_private_t));
       *m=_this;
   
       if( _this == NULL || mPriv==NULL )
  -        return JK_FALSE;
  +        return JK_ERR;
       
       _this->pool = pool;
       _this->_private=mPriv;
  @@ -276,16 +276,16 @@
       _this->clear=jk2_map_default_clear;
       
   
  -    return JK_TRUE;
  +    return JK_OK;
   }
   
   /* int map_free(jk_map_t **m) */
   /* { */
  -/*     int rc = JK_FALSE; */
  +/*     int rc = JK_ERR; */
   
   /*     if(m && *m) { */
   /*         (*m)->pool->close((*m)->pool); */
  -/*         rc = JK_TRUE; */
  +/*         rc = JK_OK; */
   /*         *m = NULL; */
   /*     } */
   /*     return rc; */
  @@ -301,11 +301,13 @@
           void **values;
           int  capacity = mPriv->capacity + CAPACITY_INC_SIZE;
   
  -        names = (char **)m->pool->alloc(env, m->pool,
  +        names = (char **)m->pool->calloc(env, m->pool,
                                           sizeof(char *) * capacity);
  -        values = (void **)m->pool->alloc(env, m->pool,
  +        values = (void **)m->pool->calloc(env, m->pool,
                                            sizeof(void *) * capacity);
  -        
  +
  +        m->keys=names;
  +        m->values=values;
           if(values && names) {
               if (mPriv->capacity && mPriv->names) 
                   memcpy(names, mPriv->names, sizeof(char *) * mPriv->capacity);
  @@ -317,9 +319,9 @@
               mPriv->values = ( void **)values;
               mPriv->capacity = capacity;
   
  -            return JK_TRUE;
  +            return JK_OK;
           }
       }
   
  -    return JK_FALSE;
  +    return JK_ERR;
   }
  
  
  
  1.11      +7 -1      jakarta-tomcat-connectors/jk/native2/include/jk_map.h
  
  Index: jk_map.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_map.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- jk_map.h	18 Mar 2002 17:58:46 -0000	1.10
  +++ jk_map.h	25 Apr 2002 19:16:14 -0000	1.11
  @@ -58,7 +58,7 @@
   /***************************************************************************
    * Description: Map object header file                                     *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
  - * Version:     $Revision: 1.10 $                                           *
  + * Version:     $Revision: 1.11 $                                           *
    ***************************************************************************/
   
   #ifndef JK_MAP_H
  @@ -116,6 +116,12 @@
   
       struct jk_pool *pool;
       void *_private;
  +
  +    /* For debuging purpose. NULL if not supported.
  +       The default impl will set them to the content
  +    */
  +    char **keys;
  +    char **values;
   };
   
   int jk2_map_default_create(struct jk_env *env, jk_map_t **m, 
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message