Minor cosmetic changes

This commit is contained in:
Luca Deri
2022-01-16 12:47:56 +01:00
parent dd325248f1
commit 42d74171b2
+7 -7
View File
@@ -878,13 +878,13 @@ static void parseOptions(int argc, char **argv) {
if(nDPI_LogLevel > NDPI_LOG_DEBUG_EXTRA) { if(nDPI_LogLevel > NDPI_LOG_DEBUG_EXTRA) {
nDPI_LogLevel = NDPI_LOG_DEBUG_EXTRA; nDPI_LogLevel = NDPI_LOG_DEBUG_EXTRA;
ndpi_free(_debug_protocols); ndpi_free(_debug_protocols);
_debug_protocols = strdup("all"); _debug_protocols = ndpi_strdup("all");
} }
break; break;
case 'u': case 'u':
ndpi_free(_debug_protocols); ndpi_free(_debug_protocols);
_debug_protocols = strdup(optarg); _debug_protocols = ndpi_strdup(optarg);
break; break;
case 'h': case 'h':
@@ -923,7 +923,7 @@ static void parseOptions(int argc, char **argv) {
break; break;
case 'w': case 'w':
results_path = strdup(optarg); results_path = ndpi_strdup(optarg);
if((results_file = fopen(results_path, "w")) == NULL) { if((results_file = fopen(results_path, "w")) == NULL) {
printf("Unable to write in file %s: quitting\n", results_path); printf("Unable to write in file %s: quitting\n", results_path);
return; return;
@@ -959,7 +959,7 @@ static void parseOptions(int argc, char **argv) {
#endif #endif
case '7': case '7':
extcap_capture_fifo = strdup(optarg); extcap_capture_fifo = ndpi_strdup(optarg);
break; break;
case '9': case '9':
@@ -3762,8 +3762,8 @@ void automataUnitTest() {
void *automa = ndpi_init_automa(); void *automa = ndpi_init_automa();
assert(automa); assert(automa);
assert(ndpi_add_string_to_automa(automa, strdup("hello")) == 0); assert(ndpi_add_string_to_automa(automa, ndpi_strdup("hello")) == 0);
assert(ndpi_add_string_to_automa(automa, strdup("world")) == 0); assert(ndpi_add_string_to_automa(automa, ndpi_strdup("world")) == 0);
ndpi_finalize_automa(automa); ndpi_finalize_automa(automa);
assert(ndpi_match_string(automa, "This is the wonderful world of nDPI") == 1); assert(ndpi_match_string(automa, "This is the wonderful world of nDPI") == 1);
ndpi_free_automa(automa); ndpi_free_automa(automa);
@@ -4203,7 +4203,7 @@ void desUnitTest() {
if(trace) { if(trace) {
printf("%2u)\t%12.3f\t%.3f\t%12.3f\t%12.3f\t %s [%.3f]\n", i, v[i], prediction, lower, upper, printf("%2u)\t%12.3f\t%.3f\t%12.3f\t%12.3f\t %s [%.3f]\n", i, v[i], prediction, lower, upper,
((rc == 0) || ((v[i] >= lower) && (v[i] <= upper))) ? "OK" : "ANOMALY", (rc == 0) ? "LEARNING" : (((v[i] >= lower) && (v[i] <= upper)) ? "OK" : "ANOMALY"),
confidence_band); confidence_band);
if(fd) if(fd)