[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35316 - in gnunet/src: cadet consensus core include mysql
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35316 - in gnunet/src: cadet consensus core include mysql regex rps util |
Date: |
Sat, 28 Feb 2015 17:21:34 +0100 |
Author: grothoff
Date: 2015-02-28 17:21:34 +0100 (Sat, 28 Feb 2015)
New Revision: 35316
Modified:
gnunet/src/cadet/gnunet-service-cadet_peer.c
gnunet/src/cadet/test_cadet.c
gnunet/src/consensus/test_consensus_api.c
gnunet/src/core/test_core_api_mq.c
gnunet/src/include/gnunet_common.h
gnunet/src/mysql/mysql.c
gnunet/src/regex/gnunet-regex-profiler.c
gnunet/src/rps/gnunet-service-rps_sampler.c
gnunet/src/util/common_allocation.c
gnunet/src/util/common_logging.c
gnunet/src/util/crypto_random.c
gnunet/src/util/mq.c
gnunet/src/util/network.c
gnunet/src/util/os_installation.c
gnunet/src/util/scheduler.c
gnunet/src/util/test_mq_client.c
Log:
generally use GNUNET_assert() instead of GNUNET_abort() to also log the error
Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c 2015-02-28 16:21:01 UTC
(rev 35315)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c 2015-02-28 16:21:34 UTC
(rev 35316)
@@ -519,7 +519,7 @@
GNUNET_NO, /* For header-only out
notification */
core_handlers); /* Register these
handlers */
if (10 < i++)
- GNUNET_abort();
+ GNUNET_assert (0);
}
GML_start ();
return;
@@ -1069,7 +1069,7 @@
case GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY:
/* This should be encapsulted */
msg_size = 0;
- GNUNET_abort ();
+ GNUNET_assert (0);
break;
default:
GNUNET_break (0);
@@ -1340,7 +1340,7 @@
GCC_2s (c), c, GC_f2s (fwd), GCP_2s (peer), size);
if (error_level == GNUNET_ERROR_TYPE_ERROR)
- GNUNET_abort ();
+ GNUNET_assert (0);
if (NULL == peer->connections)
{
/* We are not connected to this peer, ignore request. */
Modified: gnunet/src/cadet/test_cadet.c
===================================================================
--- gnunet/src/cadet/test_cadet.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/cadet/test_cadet.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -599,7 +599,7 @@
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Client %li not valid.\n", client);
- GNUNET_abort ();
+ GNUNET_assert (0);
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: (%d/%d)\n", ok, ok_goal);
data = (uint32_t *) &message[1];
Modified: gnunet/src/consensus/test_consensus_api.c
===================================================================
--- gnunet/src/consensus/test_consensus_api.c 2015-02-28 16:21:01 UTC (rev
35315)
+++ gnunet/src/consensus/test_consensus_api.c 2015-02-28 16:21:34 UTC (rev
35316)
@@ -40,7 +40,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "conclude over\n");
if (2 != elements_received)
- GNUNET_abort ();
+ GNUNET_assert (0);
GNUNET_SCHEDULER_shutdown ();
}
Modified: gnunet/src/core/test_core_api_mq.c
===================================================================
--- gnunet/src/core/test_core_api_mq.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/core/test_core_api_mq.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -88,7 +88,7 @@
}
if (num_received > NUM_MSG)
{
- GNUNET_abort ();
+ GNUNET_assert (0);
return GNUNET_SYSERR;
}
return GNUNET_OK;
@@ -127,7 +127,7 @@
GNUNET_NO, handlers);
if (NULL == core)
{
- GNUNET_abort ();
+ GNUNET_assert (0);
return;
}
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
NULL);
Modified: gnunet/src/include/gnunet_common.h
===================================================================
--- gnunet/src/include/gnunet_common.h 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/include/gnunet_common.h 2015-02-28 16:21:34 UTC (rev 35316)
@@ -443,9 +443,11 @@
/**
* @ingroup logging
* Abort the process, generate a core dump if possible.
+ * Most code should use `GNUNET_assert (0)` instead to
+ * first log the location of the failure.
*/
void
-GNUNET_abort (void) GNUNET_NORETURN;
+GNUNET_abort_ (void) GNUNET_NORETURN;
/**
@@ -585,14 +587,14 @@
* @ingroup logging
* Use this for fatal errors that cannot be handled
*/
-#define GNUNET_assert(cond) do { if (! (cond)) {
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"),
__FILE__, __LINE__); GNUNET_abort(); } } while(0)
+#define GNUNET_assert(cond) do { if (! (cond)) {
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"),
__FILE__, __LINE__); GNUNET_abort_(); } } while(0)
/**
* @ingroup logging
* Use this for fatal errors that cannot be handled
*/
-#define GNUNET_assert_at(cond, f, l) do { if (! (cond)) {
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), f, l);
GNUNET_abort(); } } while(0)
+#define GNUNET_assert_at(cond, f, l) do { if (! (cond)) {
GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), f, l);
GNUNET_abort_(); } } while(0)
/**
Modified: gnunet/src/mysql/mysql.c
===================================================================
--- gnunet/src/mysql/mysql.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/mysql/mysql.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -38,7 +38,7 @@
* a failure of the command 'cmd' with the message given
* by strerror(errno).
*/
-#define DIE_MYSQL(cmd, dbh) do { GNUNET_log_from (GNUNET_ERROR_TYPE__ERROR,
"mysql", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
mysql_error((dbh)->dbf)); GNUNET_abort(); } while(0);
+#define DIE_MYSQL(cmd, dbh) do { GNUNET_log_from (GNUNET_ERROR_TYPE__ERROR,
"mysql", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__,
mysql_error((dbh)->dbf)); GNUNET_assert (0); } while(0);
/**
* Log an error message at log-level 'level' that indicates
Modified: gnunet/src/regex/gnunet-regex-profiler.c
===================================================================
--- gnunet/src/regex/gnunet-regex-profiler.c 2015-02-28 16:21:01 UTC (rev
35315)
+++ gnunet/src/regex/gnunet-regex-profiler.c 2015-02-28 16:21:34 UTC (rev
35316)
@@ -927,7 +927,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to start/stop daemon at peer %u: %s\n", peer->id,
emsg);
- GNUNET_abort ();
+ GNUNET_assert (0);
}
else
{
@@ -942,7 +942,7 @@
{
search_peer = (search_peer + 1) % num_peers;
if (i > num_peers)
- GNUNET_abort (); /* we ran out of peers, must be a bug */
+ GNUNET_assert (0); /* we ran out of peers, must be a bug */
}
peers[search_peer].search_str = search_strings[peer->id];
peers[search_peer].search_str_matched = GNUNET_NO;
@@ -1038,7 +1038,7 @@
if (NULL != emsg || NULL == op || NULL == ca_result)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "DHT connect failed: %s\n", emsg);
- GNUNET_abort ();
+ GNUNET_assert (0);
}
GNUNET_assert (NULL != peer->dht_handle);
Modified: gnunet/src/rps/gnunet-service-rps_sampler.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps_sampler.c 2015-02-28 16:21:01 UTC (rev
35315)
+++ gnunet/src/rps/gnunet-service-rps_sampler.c 2015-02-28 16:21:34 UTC (rev
35316)
@@ -748,7 +748,7 @@
else if (GNUNET_NO == for_client)
gpc->get_peer_task = GNUNET_SCHEDULER_add_now (&sampler_get_rand_peer2,
gpc);
else
- GNUNET_abort ();
+ GNUNET_assert (0);
GNUNET_CONTAINER_DLL_insert (gpc_head, gpc_tail, gpc);
}
Modified: gnunet/src/util/common_allocation.c
===================================================================
--- gnunet/src/util/common_allocation.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/util/common_allocation.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -72,7 +72,7 @@
if (ret == NULL)
{
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc");
- GNUNET_abort ();
+ GNUNET_assert (0);
}
return ret;
}
@@ -108,7 +108,7 @@
if (ret == NULL)
{
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc");
- GNUNET_abort ();
+ GNUNET_assert (0);
}
#ifdef W32_MEM_LIMIT
*((size_t *) ret) = size;
@@ -178,7 +178,7 @@
if ((NULL == ptr) && (n > 0))
{
LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc");
- GNUNET_abort ();
+ GNUNET_assert (0);
}
#ifdef W32_MEM_LIMIT
ptr = &((size_t *) ptr)[1];
Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/util/common_logging.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -281,7 +281,7 @@
* Abort the process, generate a core dump if possible.
*/
void
-GNUNET_abort ()
+GNUNET_abort_ ()
{
#if WINDOWS
DebugBreak ();
@@ -1253,7 +1253,7 @@
#endif
#if WINDOWS
if (!InitializeCriticalSectionAndSpinCount (&output_message_cs, 0x00000400))
- GNUNET_abort ();
+ GNUNET_abort_ ();
#endif
}
Modified: gnunet/src/util/crypto_random.c
===================================================================
--- gnunet/src/util/crypto_random.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/util/crypto_random.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -283,7 +283,7 @@
FPRINTF (stderr,
_("libgcrypt has not the expected version (version %s is
required).\n"),
NEED_LIBGCRYPT_VERSION);
- GNUNET_abort ();
+ GNUNET_assert (0);
}
if ((rc = gcry_control (GCRYCTL_DISABLE_SECMEM, 0)))
FPRINTF (stderr,
Modified: gnunet/src/util/mq.c
===================================================================
--- gnunet/src/util/mq.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/util/mq.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -398,9 +398,9 @@
GNUNET_MQ_impl_current (struct GNUNET_MQ_Handle *mq)
{
if (NULL == mq->current_envelope)
- GNUNET_abort ();
+ GNUNET_assert (0);
if (NULL == mq->current_envelope->mh)
- GNUNET_abort ();
+ GNUNET_assert (0);
return mq->current_envelope->mh;
}
Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/util/network.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -1923,7 +1923,7 @@
wfds ? awrite.fd_count : 0,
aexcept.fd_count,
GetLastError ());
- GNUNET_abort ();
+ GNUNET_assert (0);
}
/* Check aexcept, if something is in there and we copied that
Modified: gnunet/src/util/os_installation.c
===================================================================
--- gnunet/src/util/os_installation.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/util/os_installation.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -173,7 +173,7 @@
real_pathlen = GetModuleFileNameW (dll_instance, modulepath, pathlen *
sizeof (wchar_t));
} while (real_pathlen >= pathlen && pathlen < 16*1024);
if (real_pathlen >= pathlen)
- GNUNET_abort ();
+ GNUNET_assert (0);
/* To be safe */
modulepath[real_pathlen] = '\0';
@@ -215,7 +215,7 @@
/* modulepath is GNUNET_PREFIX */
u8_string = u16_to_u8 (modulepath, wcslen (modulepath), NULL,
&u8_string_length);
if (NULL == u8_string)
- GNUNET_abort ();
+ GNUNET_assert (0);
upath = GNUNET_malloc (u8_string_length + 1);
memcpy (upath, u8_string, u8_string_length);
Modified: gnunet/src/util/scheduler.c
===================================================================
--- gnunet/src/util/scheduler.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/util/scheduler.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -580,7 +580,7 @@
if ((0 != (tc.reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) &&
(-1 != pos->write_fd) &&
(!GNUNET_NETWORK_fdset_test_native (ws, pos->write_fd)))
- GNUNET_abort (); // added to ready in previous select loop!
+ GNUNET_assert (0); // added to ready in previous select loop!
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Running task: %p\n",
pos);
@@ -801,7 +801,7 @@
"system");
#endif
#endif
- GNUNET_abort ();
+ GNUNET_assert (0);
break;
}
if ( (0 == ret) &&
Modified: gnunet/src/util/test_mq_client.c
===================================================================
--- gnunet/src/util/test_mq_client.c 2015-02-28 16:21:01 UTC (rev 35315)
+++ gnunet/src/util/test_mq_client.c 2015-02-28 16:21:34 UTC (rev 35316)
@@ -105,7 +105,7 @@
static void
send_trap_cb (void *cls)
{
- GNUNET_abort ();
+ GNUNET_assert (0);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35316 - in gnunet/src: cadet consensus core include mysql regex rps util,
gnunet <=