summaryrefslogtreecommitdiff
path: root/other
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-16 22:46:02 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-07-21 20:44:26 +0000
commit7245ac11ef9be2420c8356c12acc79f93ea211bb (patch)
treee971c5c6e10c2310afe4b2cd80212feac9839f2a /other
parent7c2b95ef5e4ccdae01bd104aa7400294c9ea391b (diff)
Avoid implementations in .h files or #including .c files.
Also, avoid the need for putting `_XOPEN_SOURCE` in every test file.
Diffstat (limited to 'other')
-rw-r--r--other/BUILD.bazel1
-rw-r--r--other/DHT_bootstrap.c10
-rw-r--r--other/Makefile.inc1
-rw-r--r--other/fun/cracker.c11
-rw-r--r--other/fun/sign.c4
5 files changed, 15 insertions, 12 deletions
diff --git a/other/BUILD.bazel b/other/BUILD.bazel
index beec2397..8bcdc4b4 100644
--- a/other/BUILD.bazel
+++ b/other/BUILD.bazel
@@ -5,6 +5,7 @@ cc_library(
5 hdrs = ["monolith.h"], 5 hdrs = ["monolith.h"],
6 visibility = ["//c-toxcore/auto_tests:__pkg__"], 6 visibility = ["//c-toxcore/auto_tests:__pkg__"],
7 deps = [ 7 deps = [
8 "//c-toxcore/testing:monolith",
8 "//c-toxcore/toxav:monolith", 9 "//c-toxcore/toxav:monolith",
9 "//c-toxcore/toxcore:monolith", 10 "//c-toxcore/toxcore:monolith",
10 "//c-toxcore/toxencryptsave:monolith", 11 "//c-toxcore/toxencryptsave:monolith",
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c
index b71ab0b1..347e5c82 100644
--- a/other/DHT_bootstrap.c
+++ b/other/DHT_bootstrap.c
@@ -23,11 +23,9 @@
23 * You should have received a copy of the GNU General Public License 23 * You should have received a copy of the GNU General Public License
24 * along with Tox. If not, see <http://www.gnu.org/licenses/>. 24 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
25 */ 25 */
26#define _XOPEN_SOURCE 600 26#include <stdio.h>
27 27#include <stdlib.h>
28#ifdef HAVE_CONFIG_H 28#include <string.h>
29#include "config.h"
30#endif
31 29
32#include "../toxcore/DHT.h" 30#include "../toxcore/DHT.h"
33#include "../toxcore/LAN_discovery.h" 31#include "../toxcore/LAN_discovery.h"
@@ -43,7 +41,7 @@
43#include "../toxcore/TCP_server.h" 41#include "../toxcore/TCP_server.h"
44#endif 42#endif
45 43
46#include "../testing/misc_tools.c" 44#include "../testing/misc_tools.h"
47 45
48#ifdef DHT_NODE_EXTRA_PACKETS 46#ifdef DHT_NODE_EXTRA_PACKETS
49#include "./bootstrap_node_packets.h" 47#include "./bootstrap_node_packets.h"
diff --git a/other/Makefile.inc b/other/Makefile.inc
index 10cd48b4..6d4ec593 100644
--- a/other/Makefile.inc
+++ b/other/Makefile.inc
@@ -14,6 +14,7 @@ DHT_bootstrap_CFLAGS = -I$(top_srcdir)/other \
14 14
15DHT_bootstrap_LDADD = $(LIBSODIUM_LDFLAGS) \ 15DHT_bootstrap_LDADD = $(LIBSODIUM_LDFLAGS) \
16 $(NACL_LDFLAGS) \ 16 $(NACL_LDFLAGS) \
17 libmisc_tools.la \
17 libtoxcore.la \ 18 libtoxcore.la \
18 $(LIBSODIUM_LIBS) \ 19 $(LIBSODIUM_LIBS) \
19 $(NACL_OBJECTS) \ 20 $(NACL_OBJECTS) \
diff --git a/other/fun/cracker.c b/other/fun/cracker.c
index 9cfe96d7..502a8af0 100644
--- a/other/fun/cracker.c
+++ b/other/fun/cracker.c
@@ -9,15 +9,16 @@
9 * Will try to find a public key starting with: ABCDEF 9 * Will try to find a public key starting with: ABCDEF
10 */ 10 */
11 11
12#include "../../testing/misc_tools.c" 12#include <stdlib.h>
13#include <time.h> 13#include <stdio.h>
14#include <string.h>
14 15
15/* NaCl includes*/ 16/* Sodium includes*/
16#include <sodium/crypto_scalarmult_curve25519.h> 17#include <sodium/crypto_scalarmult_curve25519.h>
17#include <sodium/randombytes.h> 18#include <sodium/randombytes.h>
18 19
19/* Sodium include*/ 20#include "../../testing/misc_tools.h"
20//#include <sodium.h> 21#include "../../toxcore/ccompat.h"
21 22
22void print_key(uint8_t *client_id) 23void print_key(uint8_t *client_id)
23{ 24{
diff --git a/other/fun/sign.c b/other/fun/sign.c
index 369bc848..007d19a0 100644
--- a/other/fun/sign.c
+++ b/other/fun/sign.c
@@ -15,10 +15,12 @@
15 * 15 *
16 * NOTE: The signature is appended to the end of the file. 16 * NOTE: The signature is appended to the end of the file.
17 */ 17 */
18#include "../../testing/misc_tools.c" // hex_string_to_bin
19#include <sodium.h> 18#include <sodium.h>
20#include <string.h> 19#include <string.h>
21 20
21#include "../../testing/misc_tools.h" // hex_string_to_bin
22#include "../../toxcore/ccompat.h"
23
22int load_file(char *filename, char **result) 24int load_file(char *filename, char **result)
23{ 25{
24 int size = 0; 26 int size = 0;