Changeset 434

Show
Ignore:
Timestamp:
07/09/2005 08:18:10 PM (3 years ago)
Author:
jan
Message:

fixed compile if memcached and/or gdbm are not available

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-1.3.x/src/mod_trigger_b4_dl.c

    r430 r434  
    105105#endif 
    106106#if defined(HAVE_GDBM_H) 
    107                         if (s->db) { 
    108                                 gdbm_close(s->db); 
    109                         } 
     107                        if (s->db) gdbm_close(s->db); 
    110108#endif 
    111109#if defined(HAVE_MEMCACHE_H) 
    112                         if (s->mc) { 
    113                                 mc_free(s->mc); 
    114                         } 
     110                        if (s->mc) mc_free(s->mc); 
    115111#endif 
    116112                         
     
    163159                s->deny_url       = buffer_init(); 
    164160                s->mc_hosts       = array_init(); 
     161                s->mc_namespace   = buffer_init(); 
    165162                 
    166163                cv[0].destination = s->db_filename; 
     
    333330        } 
    334331         
    335         if (!p->conf.trigger_regex || !p->conf.download_regex || (!p->conf.db && !p->conf.mc)) return HANDLER_GO_ON; 
     332        if (!p->conf.trigger_regex || !p->conf.download_regex) return HANDLER_GO_ON; 
     333         
     334# if !defined(HAVE_GDBM_H) && !defined(HAVE_MEMCACHE_H) 
     335        return HANDLER_GO_ON; 
     336# elif defined(HAVE_GDBM_H) && defined(HAVE_MEMCACHE_H) 
     337        if (!p->conf.db && !p->conf.mc) return HANDLER_GO_ON; 
     338        if (p->conf.db && p->conf.mc) { 
     339                /* can't decide which one */ 
     340                 
     341                return HANDLER_GO_ON; 
     342        } 
     343# elif defined(HAVE_GDBM_H) 
     344        if (!p->conf.db) return HANDLER_GO; 
     345# else 
     346        if (!p->conf.mc) return HANDLER_GO; 
     347# endif 
    336348         
    337349        if (NULL != (ds = (data_string *)array_get_element(con->request.headers, "X-Forwarded-For"))) { 
     
    352364                } 
    353365        } else { 
     366# if defined(HAVE_GDBM_H) 
    354367                if (p->conf.db) { 
    355 # if defined(HAVE_GDBM_H) 
    356368                        /* the trigger matched */ 
    357369                        datum key, val; 
     
    367379                                                "insert failed"); 
    368380                        } 
     381                } 
    369382# endif 
    370                 } else if (p->conf.mc) { 
    371 # if defined(HAVE_MEMCACHE_H) 
     383# if defined(HAVE_MEMCACHE_H)            
     384                if (p->conf.mc) { 
    372385                        buffer_copy_string_buffer(p->tmp_buf, p->conf.mc_namespace); 
    373386                        buffer_append_string(p->tmp_buf, remote_ip); 
     
    380393                                                "insert failed"); 
    381394                        } 
     395                } 
    382396# endif 
    383                 } 
    384397        } 
    385398                 
     
    393406        } else { 
    394407                /* the download uri matched */ 
    395                 time_t last_hit; 
    396                  
     408# if defined(HAVE_GDBM_H)                
    397409                if (p->conf.db) { 
    398 # if defined(HAVE_GDBM_H) 
    399410                        datum key, val; 
     411                        time_t last_hit; 
    400412                 
    401413                        key.dptr = (char *)remote_ip; 
     
    448460                                                "insert failed"); 
    449461                        } 
     462                } 
    450463# endif 
    451                 } else if (p->conf.mc) { 
    452 # if defined(HAVE_MEMCACHE_H) 
     464                 
     465# if defined(HAVE_MEMCACHE_H)            
     466                if (p->conf.mc) { 
    453467                        void *r; 
    454468                         
     
    483497                                                "insert failed"); 
    484498                        } 
     499                } 
    485500# endif 
    486                 } 
    487501        } 
    488502