summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/log.c26
-rw-r--r--lib/mqueue.c12
2 files changed, 21 insertions, 17 deletions
diff --git a/lib/log.c b/lib/log.c
index 05911375..f6231974 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -19,7 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with GNU Zebra; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * 02111-1307, USA.
*/
#include <zebra.h>
@@ -58,7 +58,7 @@ static int logfile_fd = -1; /* Used in signal handler. */
struct zlog *zlog_default = NULL;
-const char *zlog_proto_names[] =
+const char *zlog_proto_names[] =
{
"NONE",
"DEFAULT",
@@ -178,7 +178,7 @@ time_print(FILE *fp, struct timestamp_control *ctl)
}
fprintf(fp, "%s ", ctl->buf);
}
-
+
/* va_list version of zlog. */
static void
vzlog (struct zlog *zl, int priority, const char *format, va_list args)
@@ -187,7 +187,7 @@ vzlog (struct zlog *zl, int priority, const char *format, va_list args)
uvzlog(zl, priority, format, args);
UNLOCK
}
-
+
/* va_list version of zlog. Unprotected assumes mutex already held*/
static void
uvzlog (struct zlog *zl, int priority, const char *format, va_list args)
@@ -540,7 +540,7 @@ zlog_backtrace_sigsafe(int priority, void *program_counter)
for (i = 0; i < size; i++)
{
s = buf;
- if (bt)
+ if (bt)
s = str_append(LOC, bt[i]);
else {
s = str_append(LOC,"[bt ");
@@ -567,7 +567,7 @@ void
zlog_backtrace(int priority)
{
LOCK
- zlog_backtrace(priority);
+ uzlog_backtrace(priority);
UNLOCK
}
@@ -738,7 +738,7 @@ zlog_abort (const char *mess)
abort();
}
-
+
/* Open log stream */
struct zlog *
openzlog (const char *progname, zlog_proto_t protocol,
@@ -761,7 +761,7 @@ openzlog (const char *progname, zlog_proto_t protocol,
zl->default_lvl = LOG_DEBUG;
openlog (progname, syslog_flags, zl->facility);
-
+
return zl;
}
@@ -1187,15 +1187,15 @@ lookup (const struct message *mes, int key)
{
const struct message *pnt;
- for (pnt = mes; pnt->key != 0; pnt++)
- if (pnt->key == key)
+ for (pnt = mes; pnt->key != 0; pnt++)
+ if (pnt->key == key)
return pnt->str;
return "";
}
/* Older/faster version of message lookup function, but requires caller to pass
- * in the array size (instead of relying on a 0 key to terminate the search).
+ * in the array size (instead of relying on a 0 key to terminate the search).
*
* The return value is the message string if found, or the 'none' pointer
* provided otherwise.
@@ -1204,7 +1204,7 @@ const char *
mes_lookup (const struct message *meslist, int max, int index, const char *none)
{
int pos = index - meslist[0].key;
-
+
/* first check for best case: index is in range and matches the key
* value in that slot.
* NB: key numbering might be offset from 0. E.g. protocol constants
@@ -1223,7 +1223,7 @@ mes_lookup (const struct message *meslist, int max, int index, const char *none)
if (meslist->key == index)
{
const char *str = (meslist->str ? meslist->str : none);
-
+
zlog_debug ("message index %d [%s] found in position %d (max is %d)",
index, str, i, max);
return str;
diff --git a/lib/mqueue.c b/lib/mqueue.c
index 3031891e..7156e31e 100644
--- a/lib/mqueue.c
+++ b/lib/mqueue.c
@@ -293,18 +293,22 @@ mqb_init_new(mqueue_block mqb, mqueue_action action, void* arg0)
{
if (mqb == NULL)
{
- qpt_mutex_lock(&mqb_mutex) ;
+ qpt_mutex_lock(&mqb_mutex) ; /*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
mqb = mqb_free_list ;
if (mqb == NULL)
- mqb = XMALLOC(MTYPE_MQUEUE_BLOCK, sizeof(struct mqueue_block)) ;
+ {
+ dassert(mqb_free_count == 0) ;
+ mqb = XMALLOC(MTYPE_MQUEUE_BLOCK, sizeof(struct mqueue_block)) ;
+ }
else
{
+ dassert(mqb_free_count >= 0) ;
mqb_free_list = mqb->next ;
--mqb_free_count ;
} ;
- qpt_mutex_unlock(&mqb_mutex) ;
+ qpt_mutex_unlock(&mqb_mutex) ; /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
} ;
memset(mqb, 0, sizeof(struct mqueue_block)) ;
@@ -649,7 +653,7 @@ mqueue_revoke(mqueue_queue mq, void* arg0)
else
prev->next = mqb->next ;
- if (mq->tail == mqb)
+ if (mqb == mq->tail)
mq->tail = prev ;
if (mqb == mq->tail_priority)