aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-12-08 17:30:22 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-12-08 17:30:22 +0900
commit5c4b060714954a6e4571fe981b333856d2ef4a1b (patch)
tree7d26623cedb260caaac4c094c3ad436383ab12e1 /src/include
parent715ca9df95320ccb5edc8982b264cb41774b7ccc (diff)
downloadgnunet-5c4b060714954a6e4571fe981b333856d2ef4a1b.tar.gz
gnunet-5c4b060714954a6e4571fe981b333856d2ef4a1b.zip
TESTING: The testing API should properly take strings as const
Strings passed to the API should either be const and copied, or handled by the caller and free'd. Looking at the transport tests currently neither is happening. The strings are probably safer but definitely leaked. Changed the API to use "const" strings. Users of the testing API must define functions that copy (and free!) strings accordingly.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_testing_plugin.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h
index 28b505976..6c1b9c1a9 100644
--- a/src/include/gnunet_testing_plugin.h
+++ b/src/include/gnunet_testing_plugin.h
@@ -28,6 +28,8 @@
28#ifndef GNUNET_TESTING_PLUGIN_H 28#ifndef GNUNET_TESTING_PLUGIN_H
29#define GNUNET_TESTING_PLUGIN_H 29#define GNUNET_TESTING_PLUGIN_H
30 30
31#include "gnunet_common.h"
32
31#ifdef __cplusplus 33#ifdef __cplusplus
32extern "C" 34extern "C"
33{ 35{
@@ -37,20 +39,21 @@ extern "C"
37#endif 39#endif
38 40
39typedef void 41typedef void
40(*TESTING_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message, size_t 42(*TESTING_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message,
41 msg_length); 43 size_t msg_length);
42 44
43typedef void 45typedef void
44(*TESTING_CMD_HELPER_finish_cb) (); 46(*TESTING_CMD_HELPER_finish_cb) ();
45 47
46typedef void 48typedef void
47(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTING_CMD_HELPER_write_cb 49(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTING_CMD_HELPER_write_cb
48 write_message, char *router_ip, 50 write_message,
49 char *node_ip, 51 const char *router_ip,
50 char *n, 52 const char *node_ip,
51 char *m, 53 const char *n,
52 char *local_m, 54 const char *m,
53 char *topology_data, 55 const char *local_m,
56 const char *topology_data,
54 unsigned int *read_file, 57 unsigned int *read_file,
55 TESTING_CMD_HELPER_finish_cb finish_cb); 58 TESTING_CMD_HELPER_finish_cb finish_cb);
56 59