costin      02/01/11 21:08:57

  Modified:    jk/native2/common jk_lb_worker.c jk_map.c
  Log:
  Few fixes in jk_map. The 'split' code is now used for processing jni props too.
  
  Revision  Changes    Path
  1.12      +2 -2      jakarta-tomcat-connectors/jk/native2/common/jk_lb_worker.c
  
  Index: jk_lb_worker.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_lb_worker.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- jk_lb_worker.c    6 Jan 2002 09:06:02 -0000       1.11
  +++ jk_lb_worker.c    12 Jan 2002 05:08:57 -0000      1.12
  @@ -60,7 +60,7 @@
    *              several workers.                                           *
    * Author:      Gal Shachor <[EMAIL PROTECTED]>                           *
    * Based on:                                                               *
  - * Version:     $Revision: 1.11 $                                           *
  + * Version:     $Revision: 1.12 $                                           *
    ***************************************************************************/
   
   #include "jk_pool.h"
  @@ -305,7 +305,7 @@
       }
   
       worker_names=jk_map_split( env, props, props->pool,
  -                               tmp, &num_of_workers );
  +                               tmp, NULL, &num_of_workers );
   
       if( worker_names==NULL || num_of_workers==0 ) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
  
  
  
  1.12      +29 -14    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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- jk_map.c  31 Dec 2001 22:25:03 -0000      1.11
  +++ jk_map.c  12 Jan 2002 05:08:57 -0000      1.12
  @@ -58,7 +58,7 @@
   /***************************************************************************
    * Description: General purpose map object                                 *
    * Author:      Gal Shachor <[EMAIL PROTECTED]>                           *
  - * Version:     $Revision: 1.11 $                                           *
  + * Version:     $Revision: 1.12 $                                           *
    ***************************************************************************/
   
   #include "jk_global.h"
  @@ -93,6 +93,7 @@
   
       for(i = 0 ; i < mPriv->size ; i++) {
           if(0 == strcmp(mPriv->names[i], name)) {
  +            /*fprintf(stderr, "jk_map.get found %s %s \n", name, mPriv->values[i]  
); */
               return  mPriv->values[i];
           }
       }
  @@ -138,6 +139,7 @@
           mPriv->names[mPriv->size] =  (char *)name; 
           */
           mPriv->names[mPriv->size] = m->pool->pstrdup(env,m->pool, name);
  +        /* fprintf(stderr, "jk_map.set %s %s \n", name, value  ); */
           mPriv->size ++;
           rc = JK_TRUE;
       }
  @@ -286,10 +288,13 @@
   {
       char buf[1024];
   
  -    if( m==NULL || objType==NULL || objName==NULL || pname==NULL ) {
  +    if( m==NULL || objName==NULL || pname==NULL ) {
           return def;
       }
  -    sprintf(buf, "%s.%s.%s", objType, objName, pname);
  +    if( objType==NULL ) 
  +        sprintf(buf, "%s.%s", objName, pname);
  +    else
  +        sprintf(buf, "%s.%s.%s", objType, objName, pname);
       return m->get(env, m, buf );
   }
   
  @@ -352,6 +357,7 @@
   char **jk_map_split(jk_env_t *env, jk_map_t *m,
                       jk_pool_t *pool,
                       const char *listStr,
  +                    const char *sep,
                       unsigned *list_len )
   {
       char **ar = NULL;
  @@ -360,10 +366,14 @@
       char *v;
       char *l;
   
  -    if( pool == NULL )
  -        pool=m->pool;
  +    if( sep==NULL )
  +        sep=" \t,*";
       
  -    *list_len = 0;
  +    if( pool == NULL && m!=NULL )
  +        pool=m->pool;
  +
  +    if( list_len != NULL )
  +        *list_len = 0;
   
       if(listStr==NULL)
           return NULL;
  @@ -379,8 +389,9 @@
        * strtok also by a "*"
        */
   
  -    for(l = strtok(v, " \t,*") ; l ; l = strtok(NULL, " \t,*")) {
  -        if(idex == capacity) {
  +    for(l = strtok(v, sep) ; l ; l = strtok(NULL, sep)) {
  +        /* We want at least one space after idex for the null*/
  +        if(idex+1 >= capacity) {
               ar = pool->realloc(env, pool, 
                                  sizeof(char *) * (capacity + 5),
                                  ar,
  @@ -393,8 +404,12 @@
           ar[idex] = pool->pstrdup(env, pool, l);
           idex ++;
       }
  -        
  -    *list_len = idex;
  +
  +    /* Append a NULL, we have space */
  +    ar[idex]=NULL;
  +
  +    if( list_len != NULL )
  +        *list_len = idex;
   
       return ar;
   }
  @@ -569,9 +584,9 @@
    */
   char *jk_map_replaceProperties(jk_env_t *env, jk_map_t *m,
                                  struct jk_pool *resultPool, 
  -                               const char *value)
  +                               char *value)
   {
  -    char *rc = (char *)value;
  +    char *rc = value;
       char *env_start = rc;
       int rec = 0;
   
  @@ -587,10 +602,10 @@
               *env_end = ')';
   
               env_value = m->get(env, m, env_name);
  -            
  -         if(env_value != NULL ) {
  +         if(env_value == NULL ) {
              env_value=getenv( env_name );
            }
  +            /* fprintf(stderr, "XXXjk_map %s %s \n", env_name, env_value ); */
   
               if(env_value != NULL ) {
                   int offset=0;
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to