- Fix valgrind reports + CS

This commit is contained in:
Felipe Pena 2013-11-18 19:55:29 -02:00
parent a1156cae5c
commit 8951406678
3 changed files with 9 additions and 7 deletions

View file

@ -41,6 +41,7 @@ static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
pg->lcmd = NULL; pg->lcmd = NULL;
pg->flags = PHPDBG_DEFAULT_FLAGS; pg->flags = PHPDBG_DEFAULT_FLAGS;
pg->oplog = NULL; pg->oplog = NULL;
memset(&pg->lparam, 0, sizeof(phpdbg_param_t));
} /* }}} */ } /* }}} */
static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
@ -94,14 +95,14 @@ static void php_phpdbg_destroy_bp_condition(void *data) /* {{{ */
} /* }}} */ } /* }}} */
static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */ static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
{ {
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], 8, NULL, php_phpdbg_destroy_bp_file, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], 8, NULL, php_phpdbg_destroy_bp_file, 0);
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], 8, NULL, php_phpdbg_destroy_bp_symbol, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], 8, NULL, php_phpdbg_destroy_bp_symbol, 0);
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 8, NULL, NULL, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 8, NULL, NULL, 0);
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], 8, NULL, php_phpdbg_destroy_bp_methods, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], 8, NULL, php_phpdbg_destroy_bp_methods, 0);
zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], 8, NULL, php_phpdbg_destroy_bp_condition, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], 8, NULL, php_phpdbg_destroy_bp_condition, 0);
zend_hash_init(&PHPDBG_G(seek), 8, NULL, NULL, 0); zend_hash_init(&PHPDBG_G(seek), 8, NULL, NULL, 0);
return SUCCESS; return SUCCESS;
} /* }}} */ } /* }}} */
@ -113,7 +114,7 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD]); zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD]);
zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_COND]); zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_COND]);
zend_hash_destroy(&PHPDBG_G(seek)); zend_hash_destroy(&PHPDBG_G(seek));
if (PHPDBG_G(exec)) { if (PHPDBG_G(exec)) {
efree(PHPDBG_G(exec)); efree(PHPDBG_G(exec));
PHPDBG_G(exec) = NULL; PHPDBG_G(exec) = NULL;

View file

@ -153,7 +153,7 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig
return; return;
} }
last_pos = mem = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0); pos = last_pos = mem = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
end_pos = mem + st.st_size; end_pos = mem + st.st_size;
#else #else
@ -170,7 +170,7 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig
return; return;
} }
last_pos = mem = (char*) MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0); pos = last_pos = mem = (char*) MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
if (mem == NULL) { if (mem == NULL) {
phpdbg_error("Failed to map file in memory"); phpdbg_error("Failed to map file in memory");
CloseHandle(map); CloseHandle(map);

View file

@ -37,7 +37,8 @@ PHPDBG_PRINT(opline) /* {{{ */
return SUCCESS; return SUCCESS;
} /* }}} */ } /* }}} */
static inline void phpdbg_print_function_helper(zend_function *method TSRMLS_DC) { static inline void phpdbg_print_function_helper(zend_function *method TSRMLS_DC) /* {{{ */
{
switch (method->type) { switch (method->type) {
case ZEND_USER_FUNCTION: { case ZEND_USER_FUNCTION: {
zend_op_array* op_array = &method->op_array; zend_op_array* op_array = &method->op_array;
@ -85,7 +86,7 @@ static inline void phpdbg_print_function_helper(zend_function *method TSRMLS_DC)
} }
} }
} }
} } /* }}} */
PHPDBG_PRINT(exec) /* {{{ */ PHPDBG_PRINT(exec) /* {{{ */
{ {