From 49a27fac20f757c158e5faa18a41337c5f33b17b Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 11 Jan 2018 11:26:07 +0100 Subject: Remove some legacy code --- src/sp_utils.c | 4 ++-- src/sp_utils.h | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/sp_utils.c b/src/sp_utils.c index 19b7179..52e494f 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c @@ -93,7 +93,7 @@ static int construct_filename(char* filename, const char* folder, PHP_SHA256Update(&context, (const unsigned char*)textual, strlen(textual)); PHP_SHA256Final(digest, &context); make_digest_ex(strhash, digest, SHA256_SIZE); - snprintf(filename, MAX_FOLDER_LEN - 1, "%s/sp_dump.%s", folder, strhash); + snprintf(filename, PATH_MAX - 1, "%s/sp_dump.%s", folder, strhash); return 0; } @@ -102,7 +102,7 @@ int sp_log_request(const char* folder, const char* text_repr) { FILE* file; const char* current_filename = zend_get_executed_filename(TSRMLS_C); const int current_line = zend_get_executed_lineno(TSRMLS_C); - char filename[MAX_FOLDER_LEN] = {0}; + char filename[PATH_MAX] = {0}; const struct { const char* str; const int key; diff --git a/src/sp_utils.h b/src/sp_utils.h index a7b672f..ada7cf6 100644 --- a/src/sp_utils.h +++ b/src/sp_utils.h @@ -17,17 +17,6 @@ #define sp_const #endif #endif -/* The dump filename are of the form - * `sp_dump_DATE_IPADDR.dump`, with: - * - DATE being the output of asctime, 26 chars long - * - IP_ADDR being an IP adress, with a maximum size of 15 - * - * We keep one char for the terminal \0, and one for the leading slash. - */ - -#define MAX_FOLDER_LEN \ - PATH_MAX - 1 - sizeof("sp_dump_") - 26 - sizeof("_") - 15 - \ - sizeof(".dump") - 1 #define VAR_AND_LEN(var) var, strlen(var) -- cgit v1.3