Skip to content

Commit 313fe8b

Browse files
committed
Add fbp_dump_buffer() utility for dumping memory (for debug)
1 parent 426b675 commit 313fe8b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

interbase.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,6 +1589,19 @@ PHP_FUNCTION(ibase_gen_id)
15891589
RETURN_LONG((zend_long)result);
15901590
}
15911591

1592+
void fbp_dump_buffer(int len, const unsigned char *buffer){
1593+
int i;
1594+
for (i = 0; i < len; i++) {
1595+
if(buffer[i] < 31 || buffer[i] > 126)
1596+
php_printf("0x%02x ", buffer[i]);
1597+
else
1598+
php_printf("%c", buffer[i]);
1599+
}
1600+
if (i > 0) {
1601+
php_printf("\n");
1602+
}
1603+
}
1604+
15921605
/* }}} */
15931606

15941607
#endif /* HAVE_IBASE */

php_ibase_includes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,6 @@ void php_ibase_service_minit(INIT_FUNC_ARGS);
203203
#define max(a,b) ((a)>(b)?(a):(b))
204204
#endif
205205

206+
void fbp_dump_buffer(int len, const unsigned char *buffer);
207+
206208
#endif /* PHP_IBASE_INCLUDES_H */

0 commit comments

Comments
 (0)