Show
Ignore:
Timestamp:
07/10/05 10:12:34 (3 years ago)
Author:
zoeloelip
Message:

* Renamed some macros from MMC (mmcache) to EA (eg MMCG is now EAG)
* Added eA file header to mm.c, mm.h and x86-spinlocks.h
* Readded a hack to the loader to prevent zend2 segfaults

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/cache.c

    r112 r123  
    5757         * namespace  
    5858         */ 
    59         len = strlen (MMCG (name_space)); 
     59        len = strlen (EAG (name_space)); 
    6060        if (len > 0) { 
    6161                char *xkey; 
    6262                *xlen = len + key_len + 1; 
    6363                xkey = emalloc ((*xlen) + 1); 
    64                 memcpy (xkey, MMCG (name_space), len); 
     64                memcpy (xkey, EAG (name_space), len); 
    6565                xkey[len] = ':'; 
    6666                memcpy (xkey + len + 1, key, key_len + 1); 
     
    7171         * hostname  
    7272         */ 
    73         len = strlen (MMCG (hostname)); 
     73        len = strlen (EAG (hostname)); 
    7474        if (len > 0) { 
    7575                char *xkey; 
    7676                *xlen = len + key_len + 1; 
    7777                xkey = emalloc ((*xlen) + 1); 
    78                 memcpy (xkey, MMCG (hostname), len); 
     78                memcpy (xkey, EAG (hostname), len); 
    7979                xkey[len] = ':'; 
    8080                memcpy (xkey + len + 1, key, key_len + 1); 
     
    219219 
    220220        xkey = build_key (key, key_len, &xlen TSRMLS_CC); 
    221         MMCG (compress) = 1; 
    222         MMCG (mem) = NULL; 
    223         zend_hash_init (&MMCG (strings), 0, NULL, NULL, 0); 
    224         EACCELERATOR_ALIGN (MMCG (mem)); 
    225         MMCG (mem) += offsetof (mm_user_cache_entry, key) + xlen + 1; 
     221        EAG (compress) = 1; 
     222        EAG (mem) = NULL; 
     223        zend_hash_init (&EAG (strings), 0, NULL, NULL, 0); 
     224        EACCELERATOR_ALIGN (EAG (mem)); 
     225        EAG (mem) += offsetof (mm_user_cache_entry, key) + xlen + 1; 
    226226        calc_zval (val TSRMLS_CC); 
    227         zend_hash_destroy (&MMCG (strings)); 
    228  
    229         size = (long) MMCG (mem); 
    230  
    231         MMCG (mem) = NULL; 
     227        zend_hash_destroy (&EAG (strings)); 
     228 
     229        size = (long) EAG (mem); 
     230 
     231        EAG (mem) = NULL; 
    232232        if (eaccelerator_mm_instance != NULL && 
    233233                (where == eaccelerator_shm_and_disk || 
     
    235235                EACCELERATOR_UNPROTECT (); 
    236236                if (eaccelerator_shm_max == 0 || size <= eaccelerator_shm_max) { 
    237                         MMCG (mem) = eaccelerator_malloc (size); 
    238                         if (MMCG (mem) == NULL) { 
    239                                 MMCG (mem) = eaccelerator_malloc2 (size TSRMLS_CC); 
    240                         } 
    241                 } 
    242                 if (MMCG (mem) == NULL) { 
     237                        EAG (mem) = eaccelerator_malloc (size); 
     238                        if (EAG (mem) == NULL) { 
     239                                EAG (mem) = eaccelerator_malloc2 (size TSRMLS_CC); 
     240                        } 
     241                } 
     242                if (EAG (mem) == NULL) { 
    243243                        EACCELERATOR_PROTECT (); 
    244244                } 
    245245        } 
    246         if (MMCG (mem) == NULL && 
     246        if (EAG (mem) == NULL && 
    247247                (where == eaccelerator_shm_and_disk || 
    248248                 where == eaccelerator_shm || where == eaccelerator_disk_only)) { 
    249249                use_shm = 0; 
    250                 MMCG (mem) = emalloc (size); 
    251         } 
    252         if (MMCG (mem)) { 
    253                 zend_hash_init (&MMCG (strings), 0, NULL, NULL, 0); 
    254                 EACCELERATOR_ALIGN (MMCG (mem)); 
    255                 q = (mm_user_cache_entry *) MMCG (mem); 
     250                EAG (mem) = emalloc (size); 
     251        } 
     252        if (EAG (mem)) { 
     253                zend_hash_init (&EAG (strings), 0, NULL, NULL, 0); 
     254                EACCELERATOR_ALIGN (EAG (mem)); 
     255                q = (mm_user_cache_entry *) EAG (mem); 
    256256                q->size = size; 
    257                 MMCG (mem) += offsetof (mm_user_cache_entry, key) + xlen + 1; 
     257                EAG (mem) += offsetof (mm_user_cache_entry, key) + xlen + 1; 
    258258                q->hv = hash_mm (xkey, xlen); 
    259259                memcpy (q->key, xkey, xlen + 1); 
     
    261261                q->ttl = ttl ? time (0) + ttl : 0; 
    262262                store_zval (&q->value TSRMLS_CC); 
    263                 zend_hash_destroy (&MMCG (strings)); 
     263                zend_hash_destroy (&EAG (strings)); 
    264264 
    265265                /* 
     
    439439                                                && hdr.crc32 == 
    440440                                                eaccelerator_crc32 ((const char *) p, p->size)) { 
    441                                                 MMCG (mem) = (char *) ((long) p - (long) p->next); 
    442                                                 MMCG (compress) = 1; 
     441                                                EAG (mem) = (char *) ((long) p - (long) p->next); 
     442                                                EAG (compress) = 1; 
    443443                                                fixup_zval (&p->value TSRMLS_CC); 
    444444