aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-28 16:21:34 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-28 16:21:34 +0000
commitde30f210414a1f1f296c0cfb4406b171c1fc7b62 (patch)
tree570cc93d141bb7e250c4e73fafc53eba7d6e70bc /src/util
parent652e255add3511262060f3a13517716a72e3cb52 (diff)
downloadgnunet-de30f210414a1f1f296c0cfb4406b171c1fc7b62.tar.gz
gnunet-de30f210414a1f1f296c0cfb4406b171c1fc7b62.zip
generally use GNUNET_assert() instead of GNUNET_abort() to also log the error
Diffstat (limited to 'src/util')
-rw-r--r--src/util/common_allocation.c6
-rw-r--r--src/util/common_logging.c4
-rw-r--r--src/util/crypto_random.c2
-rw-r--r--src/util/mq.c4
-rw-r--r--src/util/network.c2
-rw-r--r--src/util/os_installation.c4
-rw-r--r--src/util/scheduler.c4
-rw-r--r--src/util/test_mq_client.c2
8 files changed, 14 insertions, 14 deletions
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index f89af191c..c31ad6253 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -72,7 +72,7 @@ GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber)
72 if (ret == NULL) 72 if (ret == NULL)
73 { 73 {
74 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); 74 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc");
75 GNUNET_abort (); 75 GNUNET_assert (0);
76 } 76 }
77 return ret; 77 return ret;
78} 78}
@@ -108,7 +108,7 @@ GNUNET_xmemdup_ (const void *buf, size_t size, const char *filename,
108 if (ret == NULL) 108 if (ret == NULL)
109 { 109 {
110 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); 110 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc");
111 GNUNET_abort (); 111 GNUNET_assert (0);
112 } 112 }
113#ifdef W32_MEM_LIMIT 113#ifdef W32_MEM_LIMIT
114 *((size_t *) ret) = size; 114 *((size_t *) ret) = size;
@@ -178,7 +178,7 @@ GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber)
178 if ((NULL == ptr) && (n > 0)) 178 if ((NULL == ptr) && (n > 0))
179 { 179 {
180 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc"); 180 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc");
181 GNUNET_abort (); 181 GNUNET_assert (0);
182 } 182 }
183#ifdef W32_MEM_LIMIT 183#ifdef W32_MEM_LIMIT
184 ptr = &((size_t *) ptr)[1]; 184 ptr = &((size_t *) ptr)[1];
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 747b80a63..695b49913 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -281,7 +281,7 @@ resize_logdefs ()
281 * Abort the process, generate a core dump if possible. 281 * Abort the process, generate a core dump if possible.
282 */ 282 */
283void 283void
284GNUNET_abort () 284GNUNET_abort_ ()
285{ 285{
286#if WINDOWS 286#if WINDOWS
287 DebugBreak (); 287 DebugBreak ();
@@ -1253,7 +1253,7 @@ GNUNET_util_cl_init ()
1253#endif 1253#endif
1254#if WINDOWS 1254#if WINDOWS
1255 if (!InitializeCriticalSectionAndSpinCount (&output_message_cs, 0x00000400)) 1255 if (!InitializeCriticalSectionAndSpinCount (&output_message_cs, 0x00000400))
1256 GNUNET_abort (); 1256 GNUNET_abort_ ();
1257#endif 1257#endif
1258} 1258}
1259 1259
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index 616f5534c..2960af17e 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -283,7 +283,7 @@ GNUNET_CRYPTO_random_init ()
283 FPRINTF (stderr, 283 FPRINTF (stderr,
284 _("libgcrypt has not the expected version (version %s is required).\n"), 284 _("libgcrypt has not the expected version (version %s is required).\n"),
285 NEED_LIBGCRYPT_VERSION); 285 NEED_LIBGCRYPT_VERSION);
286 GNUNET_abort (); 286 GNUNET_assert (0);
287 } 287 }
288 if ((rc = gcry_control (GCRYCTL_DISABLE_SECMEM, 0))) 288 if ((rc = gcry_control (GCRYCTL_DISABLE_SECMEM, 0)))
289 FPRINTF (stderr, 289 FPRINTF (stderr,
diff --git a/src/util/mq.c b/src/util/mq.c
index b73cf176f..14e0816e2 100644
--- a/src/util/mq.c
+++ b/src/util/mq.c
@@ -398,9 +398,9 @@ const struct GNUNET_MessageHeader *
398GNUNET_MQ_impl_current (struct GNUNET_MQ_Handle *mq) 398GNUNET_MQ_impl_current (struct GNUNET_MQ_Handle *mq)
399{ 399{
400 if (NULL == mq->current_envelope) 400 if (NULL == mq->current_envelope)
401 GNUNET_abort (); 401 GNUNET_assert (0);
402 if (NULL == mq->current_envelope->mh) 402 if (NULL == mq->current_envelope->mh)
403 GNUNET_abort (); 403 GNUNET_assert (0);
404 return mq->current_envelope->mh; 404 return mq->current_envelope->mh;
405} 405}
406 406
diff --git a/src/util/network.c b/src/util/network.c
index 22e77818d..63dfe330b 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -1923,7 +1923,7 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
1923 wfds ? awrite.fd_count : 0, 1923 wfds ? awrite.fd_count : 0,
1924 aexcept.fd_count, 1924 aexcept.fd_count,
1925 GetLastError ()); 1925 GetLastError ());
1926 GNUNET_abort (); 1926 GNUNET_assert (0);
1927 } 1927 }
1928 1928
1929 /* Check aexcept, if something is in there and we copied that 1929 /* Check aexcept, if something is in there and we copied that
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index cf3c027e9..bc7e49512 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -173,7 +173,7 @@ get_path_from_module_filename ()
173 real_pathlen = GetModuleFileNameW (dll_instance, modulepath, pathlen * sizeof (wchar_t)); 173 real_pathlen = GetModuleFileNameW (dll_instance, modulepath, pathlen * sizeof (wchar_t));
174 } while (real_pathlen >= pathlen && pathlen < 16*1024); 174 } while (real_pathlen >= pathlen && pathlen < 16*1024);
175 if (real_pathlen >= pathlen) 175 if (real_pathlen >= pathlen)
176 GNUNET_abort (); 176 GNUNET_assert (0);
177 /* To be safe */ 177 /* To be safe */
178 modulepath[real_pathlen] = '\0'; 178 modulepath[real_pathlen] = '\0';
179 179
@@ -215,7 +215,7 @@ get_path_from_module_filename ()
215 /* modulepath is GNUNET_PREFIX */ 215 /* modulepath is GNUNET_PREFIX */
216 u8_string = u16_to_u8 (modulepath, wcslen (modulepath), NULL, &u8_string_length); 216 u8_string = u16_to_u8 (modulepath, wcslen (modulepath), NULL, &u8_string_length);
217 if (NULL == u8_string) 217 if (NULL == u8_string)
218 GNUNET_abort (); 218 GNUNET_assert (0);
219 219
220 upath = GNUNET_malloc (u8_string_length + 1); 220 upath = GNUNET_malloc (u8_string_length + 1);
221 memcpy (upath, u8_string, u8_string_length); 221 memcpy (upath, u8_string, u8_string_length);
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 351b20f22..d78de9468 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -580,7 +580,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs,
580 if ((0 != (tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) && 580 if ((0 != (tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) &&
581 (-1 != pos->write_fd) && 581 (-1 != pos->write_fd) &&
582 (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd))) 582 (!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd)))
583 GNUNET_abort (); // added to ready in previous select loop! 583 GNUNET_assert (0); // added to ready in previous select loop!
584 LOG (GNUNET_ERROR_TYPE_DEBUG, 584 LOG (GNUNET_ERROR_TYPE_DEBUG,
585 "Running task: %p\n", 585 "Running task: %p\n",
586 pos); 586 pos);
@@ -801,7 +801,7 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task,
801 "system"); 801 "system");
802#endif 802#endif
803#endif 803#endif
804 GNUNET_abort (); 804 GNUNET_assert (0);
805 break; 805 break;
806 } 806 }
807 if ( (0 == ret) && 807 if ( (0 == ret) &&
diff --git a/src/util/test_mq_client.c b/src/util/test_mq_client.c
index a8a1a64a0..61e027df5 100644
--- a/src/util/test_mq_client.c
+++ b/src/util/test_mq_client.c
@@ -105,7 +105,7 @@ send_cb (void *cls)
105static void 105static void
106send_trap_cb (void *cls) 106send_trap_cb (void *cls)
107{ 107{
108 GNUNET_abort (); 108 GNUNET_assert (0);
109} 109}
110 110
111 111