diff options
| author | jvoisin | 2017-09-21 16:19:44 +0200 |
|---|---|---|
| committer | jvoisin | 2017-09-22 17:45:32 +0200 |
| commit | 3ba2b7e37cb24f951f557c4a4f62920154a7c0d2 (patch) | |
| tree | c904d0acf0e7eddb0a3697baff59cc237a7d6250 /src | |
| parent | 6487590b4fd55dddd59b43f1fcf2ebd8d56f20ac (diff) | |
Improve a bit the .travis.yml file
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.m4 | 13 | ||||
| -rw-r--r-- | src/sp_utils.c | 7 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/config.m4 b/src/config.m4 index 84ca2f4..4f70871 100644 --- a/src/config.m4 +++ b/src/config.m4 | |||
| @@ -19,8 +19,9 @@ PHP_ARG_ENABLE(debug, whether to enable debug messages, | |||
| 19 | CFLAGS="$CFLAGS -lpcre" | 19 | CFLAGS="$CFLAGS -lpcre" |
| 20 | CFLAGS="$CFLAGS -D_DEFAULT_SOURCE=1 -std=c99" | 20 | CFLAGS="$CFLAGS -D_DEFAULT_SOURCE=1 -std=c99" |
| 21 | CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter" | 21 | CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter" |
| 22 | CFLAGS="$CFLAGS --coverage" | ||
| 22 | 23 | ||
| 23 | LFLAGS="$LFLAGS -lpcre" | 24 | LDFLAGS="$LDFLAGS -lpcre --coverage" |
| 24 | 25 | ||
| 25 | if test "$PHP_DEBUG" = "yes"; then | 26 | if test "$PHP_DEBUG" = "yes"; then |
| 26 | AC_DEFINE(SP_DEBUG, 1, [Wether you want to enable debug messages]) | 27 | AC_DEFINE(SP_DEBUG, 1, [Wether you want to enable debug messages]) |
| @@ -28,12 +29,14 @@ fi | |||
| 28 | 29 | ||
| 29 | AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre])) | 30 | AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE(HAVE_PCRE, 1, [have pcre])) |
| 30 | 31 | ||
| 31 | if test "$PHP_SNUFFLEUPAGUS" != "no"; then | 32 | if test "$PHP_SNUFFLEUPAGUS" = "yes"; then |
| 32 | if test "$PHP_COVERAGE" != "no"; then | 33 | if test "$PHP_COVERAGE" = "yes"; then |
| 33 | CFLAGS="$CFLAGS --coverage -fprofile-arcs -ftest-coverage" | 34 | CFLAGS="$CFLAGS --coverage" |
| 34 | LDFLAGS="$LDFLAGS --coverage" | 35 | LDFLAGS="$LDFLAGS --coverage" |
| 35 | PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -g -fprofile-arcs -ftest-coverage -lgcov) | 36 | PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -g --coverage -lgcov) |
| 36 | else | 37 | else |
| 38 | CFLAGS="$CFLAGS --coverage" | ||
| 39 | LDFLAGS="$LDFLAGS --coverage" | ||
| 37 | PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) | 40 | PHP_NEW_EXTENSION(snuffleupagus, $sources, $ext_shared,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) |
| 38 | fi | 41 | fi |
| 39 | fi | 42 | fi |
diff --git a/src/sp_utils.c b/src/sp_utils.c index 56512df..2370a6d 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c | |||
| @@ -39,7 +39,7 @@ int compute_hash(const char* const filename, char* file_hash) { | |||
| 39 | php_stream_open_wrapper(filename, "rb", REPORT_ERRORS, NULL); | 39 | php_stream_open_wrapper(filename, "rb", REPORT_ERRORS, NULL); |
| 40 | if (!stream) { | 40 | if (!stream) { |
| 41 | sp_log_err("hash_computation", "Can not open the file %s to compute its hash.\n", filename); | 41 | sp_log_err("hash_computation", "Can not open the file %s to compute its hash.\n", filename); |
| 42 | return -1; | 42 | return FAILURE; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | PHP_SHA256Init(&context); | 45 | PHP_SHA256Init(&context); |
| @@ -49,7 +49,7 @@ int compute_hash(const char* const filename, char* file_hash) { | |||
| 49 | PHP_SHA256Final(digest, &context); | 49 | PHP_SHA256Final(digest, &context); |
| 50 | php_stream_close(stream); | 50 | php_stream_close(stream); |
| 51 | make_digest_ex(file_hash, digest, SHA256_SIZE); | 51 | make_digest_ex(file_hash, digest, SHA256_SIZE); |
| 52 | return 0; | 52 | return SUCCESS; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static void construct_filename(char* filename, const char* folder) { | 55 | static void construct_filename(char* filename, const char* folder) { |
| @@ -123,7 +123,7 @@ int sp_log_request(const char* folder) { | |||
| 123 | 123 | ||
| 124 | // Allocate and copy the data | 124 | // Allocate and copy the data |
| 125 | // FIXME Why are we even allocating? | 125 | // FIXME Why are we even allocating? |
| 126 | param = pecalloc(params_len, 1, 0); | 126 | param = ecalloc(params_len, 1); |
| 127 | NCAT_AND_DEC(param, zones[i].str, params_len); | 127 | NCAT_AND_DEC(param, zones[i].str, params_len); |
| 128 | NCAT_AND_DEC(param, ":", params_len); | 128 | NCAT_AND_DEC(param, ":", params_len); |
| 129 | ZEND_HASH_FOREACH_STR_KEY_VAL(ht, variable_key, variable_value) { | 129 | ZEND_HASH_FOREACH_STR_KEY_VAL(ht, variable_key, variable_value) { |
| @@ -138,6 +138,7 @@ int sp_log_request(const char* folder) { | |||
| 138 | 138 | ||
| 139 | fputs(param, file); | 139 | fputs(param, file); |
| 140 | fputs("\n", file); | 140 | fputs("\n", file); |
| 141 | efree(param); | ||
| 141 | } | 142 | } |
| 142 | fclose(file); | 143 | fclose(file); |
| 143 | 144 | ||
