example: Fix build warnings of allocate_module.
authorAndreas Schneider <asn@cryptomilk.org>
Tue, 31 May 2011 20:50:56 +0000 (22:50 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 31 May 2011 20:50:56 +0000 (22:50 +0200)
src/example/allocate_module.c
src/example/allocate_module_test.c

index 634932b..c6df8c6 100644 (file)
@@ -32,18 +32,22 @@ extern void _test_free(void* const ptr, const char* file, const int line);
 #define free(ptr) _test_free(ptr, __FILE__, __LINE__)
 #endif // UNIT_TESTING
 
-void leak_memory() {
+void leak_memory(void);
+void buffer_overflow(void);
+void buffer_underflow(void);
+
+void leak_memory(void) {
     int * const temporary = (int*)malloc(sizeof(int));
     *temporary = 0;
 }
 
-void buffer_overflow() {
+void buffer_overflow(void) {
     char * const memory = (char*)malloc(sizeof(int));
     memory[sizeof(int)] = '!';
     free(memory);
 }
 
-void buffer_underflow() {
+void buffer_underflow(void) {
     char * const memory = (char*)malloc(sizeof(int));
     memory[-1] = '!';
     free(memory);
index 3e9c022..b4519b5 100644 (file)
@@ -23,17 +23,17 @@ extern void buffer_overflow();
 extern void buffer_underflow();
 
 // Test case that fails as leak_memory() leaks a dynamically allocated block.
-void leak_memory_test(void **state) {
+static void leak_memory_test(void **state) {
     leak_memory();
 }
 
 // Test case that fails as buffer_overflow() corrupts an allocated block.
-void buffer_overflow_test(void **state) {
+static void buffer_overflow_test(void **state) {
     buffer_overflow();
 }
 
 // Test case that fails as buffer_underflow() corrupts an allocated block.
-void buffer_underflow_test(void **state) {
+static void buffer_underflow_test(void **state) {
     buffer_underflow();
 }