Changeset 1045 in svn for trunk/xcache/xc_extension.c


Ignore:
Timestamp:
2012-07-25T09:32:11Z (3 years ago)
Author:
Xuefer
Message:

refactor: bring back compatibility with Zend Optimizer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache/xc_extension.c

    r1026 r1045  
    55
    66
    7 int xcache_zend_extension_register(zend_extension *new_extension, zend_bool prepend) /* {{{ */
     7int xcache_zend_extension_prepend(zend_extension *new_extension) /* {{{ */
    88{
    99    zend_extension extension;
     
    1414    zend_extension_dispatch_message(ZEND_EXTMSG_NEW_EXTENSION, &extension);
    1515
    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");
     16    zend_llist_prepend_element(&zend_extensions, &extension);
     17    TRACE("%s", "prepended");
    2318    return SUCCESS;
    2419}
     
    4136}
    4237/* }}} */
    43 int xcache_zend_extension_unregister(zend_extension *extension) /* {{{ */
     38int xcache_zend_extension_remove(zend_extension *extension) /* {{{ */
    4439{
    4540    zend_extension *ext = zend_get_extension(extension->name);
     
    5651/* }}} */
    5752
    58 zend_llist_element *xcache_llist_get_element_by_zend_extension(zend_llist *l, const char *extension_name) /* {{{ */
     53int xcache_zend_extension_count_by_prefix(zend_llist *l, const char *extension_name_prefix) /* {{{ */
    5954{
    6055    zend_llist_element *element;
     56    size_t n = strlen(extension_name_prefix);
     57    int count = 0;
    6158
    6259    for (element = zend_extensions.head; element; element = element->next) {
    6360        zend_extension *extension = (zend_extension *) element->data;
    6461
    65         if (!strcmp(extension->name, extension_name)) {
    66             return element;
     62        if (strncmp(extension->name, extension_name_prefix, n) == 0) {
     63            ++count;
    6764        }
    6865    }
    69     return NULL;
     66    return count;
     67}
     68/* }}} */
     69void 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    }
    7089}
    7190/* }}} */
Note: See TracChangeset for help on using the changeset viewer.