From: krakjoe Date: Mon, 2 Dec 2013 13:43:21 +0000 (+0000) Subject: cs X-Git-Tag: php-5.6.0alpha1~110^2~30^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b4e855d72a4624baa01c4c608f3a02171cab933;p=php cs --- diff --git a/phpdbg_bp.c b/phpdbg_bp.c index 125ceaa519..caf3c8ac0a 100644 --- a/phpdbg_bp.c +++ b/phpdbg_bp.c @@ -592,70 +592,59 @@ result: PHPDBG_API void phpdbg_delete_breakpoint(zend_ulong num TSRMLS_DC) /* {{{ */ { HashTable **table; - - if (zend_hash_index_find(&PHPDBG_G(bp)[PHPDBG_BREAK_MAP], num, (void**)&table) == SUCCESS) { - HashPosition position; - phpdbg_breakbase_t *brake; - - for (zend_hash_internal_pointer_reset_ex((*table), &position); - zend_hash_get_current_data_ex((*table), (void**)&brake, &position) == SUCCESS; - zend_hash_move_forward_ex((*table), &position)) { - char *key; - zend_uint klen; - zend_ulong idx; - - if (brake->id == num) { - int type = brake->type; - char *name = NULL; - size_t name_len = 0L; - - switch (type) { - case PHPDBG_BREAK_FILE: - case PHPDBG_BREAK_METHOD: - if (zend_hash_num_elements((*table)) == 1) { - name = estrdup(brake->name); - name_len = strlen(name); - if (zend_hash_num_elements(&PHPDBG_G(bp)[type]) == 1) { - PHPDBG_G(flags) &= ~(1<<(brake->type+1)); - } - } - break; - - default: { - if (zend_hash_num_elements((*table)) == 1) { - PHPDBG_G(flags) &= ~(1<<(brake->type+1)); - } + HashPosition position; + phpdbg_breakbase_t *brake; + + if ((brake = phpdbg_find_breakbase_ex(num, &table, &position TSRMLS_CC))) { + char *key; + zend_uint klen; + zend_ulong idx; + int type = brake->type; + char *name = NULL; + size_t name_len = 0L; + + switch (type) { + case PHPDBG_BREAK_FILE: + case PHPDBG_BREAK_METHOD: + if (zend_hash_num_elements((*table)) == 1) { + name = estrdup(brake->name); + name_len = strlen(name); + if (zend_hash_num_elements(&PHPDBG_G(bp)[type]) == 1) { + PHPDBG_G(flags) &= ~(1<<(brake->type+1)); } } + break; - switch (zend_hash_get_current_key_ex( - (*table), &key, &klen, &idx, 0, &position)) { + default: { + if (zend_hash_num_elements((*table)) == 1) { + PHPDBG_G(flags) &= ~(1<<(brake->type+1)); + } + } + } - case HASH_KEY_IS_STRING: - zend_hash_del((*table), key, klen); - break; + switch (zend_hash_get_current_key_ex( + (*table), &key, &klen, &idx, 0, &position)) { - default: - zend_hash_index_del((*table), idx); - } + case HASH_KEY_IS_STRING: + zend_hash_del((*table), key, klen); + break; - switch (type) { - case PHPDBG_BREAK_FILE: - case PHPDBG_BREAK_METHOD: - if (name) { - zend_hash_del(&PHPDBG_G(bp)[type], name, name_len); - efree(name); - } - break; - } + default: + zend_hash_index_del((*table), idx); + } - phpdbg_notice("Deleted breakpoint #%ld", num); - PHPDBG_BREAK_UNMAPPING(num); - return; - } + switch (type) { + case PHPDBG_BREAK_FILE: + case PHPDBG_BREAK_METHOD: + if (name) { + zend_hash_del(&PHPDBG_G(bp)[type], name, name_len); + efree(name); + } + break; } - phpdbg_error("Failed to delete breakpoint #%ld", num); + phpdbg_notice("Deleted breakpoint #%ld", num); + PHPDBG_BREAK_UNMAPPING(num); } else { phpdbg_error("Failed to find breakpoint #%ld", num); } diff --git a/phpdbg_bp.h b/phpdbg_bp.h index 55ffa7458d..d9ed37dbaa 100644 --- a/phpdbg_bp.h +++ b/phpdbg_bp.h @@ -100,8 +100,6 @@ PHPDBG_API void phpdbg_set_breakpoint_expression(const char* expression, size_t PHPDBG_API phpdbg_breakbase_t* phpdbg_find_breakpoint(zend_execute_data* TSRMLS_DC); /* }}} */ /* {{{ Misc Breakpoint API */ -PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase(zend_ulong id TSRMLS_DC); -PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase_ex(zend_ulong id, HashTable ***table, HashPosition *position TSRMLS_DC); PHPDBG_API void phpdbg_hit_breakpoint(phpdbg_breakbase_t* brake, zend_bool output TSRMLS_DC); PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC); PHPDBG_API void phpdbg_print_breakpoint(phpdbg_breakbase_t* brake TSRMLS_DC); @@ -113,6 +111,10 @@ PHPDBG_API void phpdbg_enable_breakpoint(zend_ulong id TSRMLS_DC); PHPDBG_API void phpdbg_disable_breakpoint(zend_ulong id TSRMLS_DC); PHPDBG_API void phpdbg_disable_breakpoints(TSRMLS_D); /* }}} */ +/* {{{ Breakbase API */ +PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase(zend_ulong id TSRMLS_DC); +PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase_ex(zend_ulong id, HashTable ***table, HashPosition *position TSRMLS_DC); /* }}} */ + /* {{{ Breakpoint Exportation API */ PHPDBG_API void phpdbg_export_breakpoints(FILE *handle TSRMLS_DC); /* }}} */