Ignore:
Timestamp:
2012-07-25T12:56:27+02:00 (21 months ago)
Author:
moo
Message:

refactor: fall back to more simpler trick

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache/xc_extension.c

    r1045 r1047  
    55 
    66 
    7 int xcache_zend_extension_prepend(zend_extension *new_extension) /* {{{ */ 
     7int xcache_zend_extension_add(zend_extension *new_extension, zend_bool prepend) /* {{{ */ 
    88{ 
    99    zend_extension extension; 
     
    1414    zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension); 
    1515 
    16     zend_llist_prepend_element(&zend_extensions, &extension); 
    17     TRACE("%s", "prepended"); 
     16    if (prepend) { 
     17        zend_llist_prepend_element(&zend_extensions, &extension); 
     18    } 
     19    else { 
     20        zend_llist_add_element(&zend_extensions, &extension); 
     21    } 
     22    TRACE("%s", "registered"); 
    1823    return SUCCESS; 
    1924} 
     
    5156/* }}} */ 
    5257 
    53 int xcache_zend_extension_count_by_prefix(zend_llist *l, const char *extension_name_prefix) /* {{{ */ 
    54 { 
    55     zend_llist_element *element; 
    56     size_t n = strlen(extension_name_prefix); 
    57     int count = 0; 
    58  
    59     for (element = zend_extensions.head; element; element = element->next) { 
    60         zend_extension *extension = (zend_extension *) element->data; 
    61  
    62         if (strncmp(extension->name, extension_name_prefix, n) == 0) { 
    63             ++count; 
    64         } 
    65     } 
    66     return count; 
    67 } 
    68 /* }}} */ 
    69 void xcache_zend_extension_unlink_by_prefix(xc_stack_t *linked, zend_llist *l, const char *extension_name_prefix) /* {{{ */ 
    70 { 
    71     size_t n = strlen(extension_name_prefix); 
    72     zend_llist_element *unlinked = NULL; 
    73     zend_llist_element *element, *next; 
    74  
    75     for (element = zend_extensions.head; element; element = next) { 
    76         zend_extension *extension = (zend_extension *) element->data; 
    77         next = element->next; 
    78  
    79         if (strncmp(extension->name, extension_name_prefix, n) == 0) { 
    80             xcache_llist_unlink(l, element); 
    81             xc_stack_push(linked, element); 
    82         } 
    83     } 
    84  
    85     for (element = zend_extensions.head; element; element = next) { 
    86         zend_extension *extension = (zend_extension *) element->data; 
    87         next = element->next; 
    88     } 
    89 } 
    90 /* }}} */ 
    9158void xcache_llist_prepend(zend_llist *l, zend_llist_element *element) /* {{{ */ 
    9259{ 
Note: See TracChangeset for help on using the changeset viewer.