* Copyright 2002 Project Purple
*/
-#include <assert.h>
#include <stdlib.h>
#include "armor.h"
#include "keystructs.h"
+#include "log.h"
#include "onak-conf.h"
#include "parsekey.h"
} else if (c == 63) {
c = '/';
} else {
- assert(c < 64);
+ log_assert(c < 64);
}
return c;
unsigned char t;
int i;
- assert(ctx != NULL);
+ log_assert(ctx != NULL);
state = (struct armor_context *) ctx;
switch (state->curoctet++) {
unsigned char tmpc;
int i;
- assert(ctx != NULL);
+ log_assert(ctx != NULL);
state = (struct dearmor_context *) ctx;
*c = 0;
* Copyright 2004 Project Purple
*/
-#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
struct openpgp_signedpacket_list *tmp = NULL;
int merged = 0;
- assert(key != NULL);
+ log_assert(key != NULL);
curuid = key->uids;
while (curuid != NULL) {
dup = find_signed_packet(curuid->next, curuid->packet);
while (tmp != NULL && tmp->next != dup) {
tmp = tmp->next;
}
- assert(tmp != NULL);
+ log_assert(tmp != NULL);
tmp->next = dup->next;
dup->next = NULL;
free_signedpacket_list(dup);
* Copyright 2002 Project Purple
*/
-#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
int length = 0;
int packetlen = 0;
- assert(data != NULL);
+ log_assert(data != NULL);
length = (data[0] << 8) + data[1] + 2;
* Copyright 2002-2004 Project Purple
*/
-#include <assert.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <ctype.h>
{
int ret;
- assert(dbenv != NULL);
- assert(txn == NULL);
+ log_assert(dbenv != NULL);
+ log_assert(txn == NULL);
ret = dbenv->txn_begin(dbenv,
NULL, /* No parent transaction */
{
int ret;
- assert(dbenv != NULL);
- assert(txn != NULL);
+ log_assert(dbenv != NULL);
+ log_assert(txn != NULL);
ret = txn->commit(txn,
0);
#include <sys/types.h>
-#include "assert.h"
#include "keyid.h"
#include "keystructs.h"
#include "log.h"
unsigned char c;
size_t modlen, explen;
- assert(fingerprint != NULL);
- assert(len != NULL);
+ log_assert(fingerprint != NULL);
+ log_assert(len != NULL);
*len = 0;
size_t length = 0;
unsigned char buff[20];
- assert(packet != NULL);
+ log_assert(packet != NULL);
switch (packet->data[0]) {
case 2:
* Copyright 2002 Project Purple
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
* Copyright 2000-2002 Project Purple
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "ll.h"
+#include "log.h"
struct ll *lladd(struct ll *curll, void *object)
{
struct ll *cur = NULL;
struct ll *old = NULL;
- assert(objectcmp != NULL);
+ log_assert(objectcmp != NULL);
cur = curll;
if (cur == NULL) {
{
struct ll *cur;
- assert(objectcmp != NULL);
+ log_assert(objectcmp != NULL);
cur = curll;
while (cur != NULL && (*objectcmp)(cur->object, object)) {
#ifndef __LOG_H__
#define __LOG_H__
+#include <assert.h>
+
+#define log_assert(expr) \
+ if (!(expr)) { \
+ logthing(LOGTHING_CRITICAL, \
+ "Assertion %s failed in %s, line %d", \
+ #expr, \
+ __FILE__, \
+ __LINE__); \
+ } \
+ assert(expr)
+
/*
* loglevels - levels of severity for a log entry
*
* Copyright 2002 Project Purple
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "keystructs.h"
#include "ll.h"
+#include "log.h"
#include "mem.h"
/**
{
struct openpgp_packet *newpacket = NULL;
- assert(packet != NULL);
+ log_assert(packet != NULL);
newpacket = malloc(sizeof (struct openpgp_packet));
if (newpacket != NULL) {
struct openpgp_packet_list **list_end,
struct openpgp_packet_list *packet_list)
{
- assert(list != NULL);
- assert(list_end != NULL);
+ log_assert(list != NULL);
+ log_assert(list_end != NULL);
for (; packet_list != NULL; packet_list = packet_list->next) {
ADD_PACKET_TO_LIST((*list_end),
* including the data part.
*/
void free_packet(struct openpgp_packet *packet) {
- assert(packet != NULL);
+ log_assert(packet != NULL);
if (packet->data != NULL) {
free(packet->data);
void free_packet_list(struct openpgp_packet_list *packet_list) {
struct openpgp_packet_list *nextpacket = NULL;
- assert(packet_list != NULL);
+ log_assert(packet_list != NULL);
while (packet_list != NULL) {
nextpacket = packet_list->next;
struct openpgp_signedpacket_list *signedpacket_list) {
struct openpgp_signedpacket_list *nextpacket = NULL;
- assert(signedpacket_list != NULL);
+ log_assert(signedpacket_list != NULL);
while (signedpacket_list != NULL) {
nextpacket = signedpacket_list->next;
void free_publickey(struct openpgp_publickey *key) {
struct openpgp_publickey *nextkey = NULL;
- assert(key != NULL);
+ log_assert(key != NULL);
while (key != NULL) {
nextkey = key->next;
* Copyright 2002 Project Purple
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct openpgp_packet_list *curpacket = NULL;
struct openpgp_packet_list *nextpacket = NULL;
- assert(compare_packets(old->packet, new->packet));
+ log_assert(compare_packets(old->packet, new->packet));
curpacket = new->sigs;
while (curpacket != NULL) {
if (lastpacket != NULL) {
lastpacket->next = curpacket->next;
} else {
- assert(curpacket == new->sigs);
+ log_assert(curpacket == new->sigs);
new->sigs = curpacket->next;
}
curpacket->next = NULL;
if (lastpacket != NULL) {
lastpacket->next = curpacket->next;
} else {
- assert(curpacket == b->revocations);
+ log_assert(curpacket == b->revocations);
b->revocations = curpacket->next;
}
curpacket->next = NULL;
* Copyright 2002 Project Purple
*/
-#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
* key (it should be a revocation), to the current UID
* or the current subkey.
*/
- assert(curkey != NULL);
+ log_assert(curkey != NULL);
if (curkey->subkeys != NULL) {
ADD_PACKET_TO_LIST_END(curkey->last_subkey,
sig,
/*
* It's a UID packet (or a photo id, which is similar).
*/
- assert(curkey != NULL);
- assert(curkey->subkeys == NULL);
+ log_assert(curkey != NULL);
+ log_assert(curkey->subkeys == NULL);
ADD_PACKET_TO_LIST_END(curkey,
uid,
packet_dup(packets->packet));
/*
* It's a subkey packet.
*/
- assert(curkey != NULL);
+ log_assert(curkey != NULL);
ADD_PACKET_TO_LIST_END(curkey,
subkey,
packet_dup(packets->packet));
int keys = 0;
bool inpacket = false;
- assert(packets != NULL);
+ log_assert(packets != NULL);
curpacket = *packets;
if (curpacket != NULL) {
while (curpacket->next != NULL) {
* Copyright 2004 Project Purple
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
int i = 0;
int j = 0;
- assert(key != NULL);
- assert(photo != NULL);
- assert(length != NULL);
+ log_assert(key != NULL);
+ log_assert(photo != NULL);
+ log_assert(length != NULL);
*photo = NULL;