added assert for render, removed LPC assert

This commit is contained in:
tg(x) 2011-04-25 22:31:21 +02:00
parent 62814badae
commit 16d24be752
4 changed files with 6 additions and 16 deletions

View File

@ -3,7 +3,7 @@
#ifdef DEBUG
# include <stdio.h>
# define PP(args) printf args;
# define PP(args) printf(args);
#else
# define PP(args)
#endif
@ -82,18 +82,4 @@
# define P4(MSG)
#endif
// ASSERT() unused as yet
#if DEBUG > 0
# ifdef STRICT
# define ASSERT(NAME,COND,VALUE) { unless (COND) { \
PP(("Assertion %s failed in %s: %s\n", NAME, ME, VALUE)); \
raise_error("Assertion failed (strict mode).\n"); } }
# else
# define ASSERT(NAME,COND,VALUE) { unless (COND) \
PP(("Assertion %s failed in %s: %s\n", NAME, ME, VALUE)); }
# endif
#else
# define ASSERT(NAME,CONDITION,VALUE)
#endif
#endif // DEBUG_H

View File

@ -6,6 +6,7 @@
#include "../psyc.h"
#include "./debug.h"
#include <sys/cdefs.h>
#include <assert.h>
/* perlisms for readability */
#define unless(COND) if (!(COND))

View File

@ -58,6 +58,9 @@ PSYC_RenderRC PSYC_render(PSYC_Packet *packet, char *buffer, size_t buflen)
}
memcpy(buffer + cur, PSYC_PACKET_DELIMITER + 1, 2);
cur += 2;
assert(cur == packet->length);
return PSYC_RENDER_SUCCESS;
}

View File

@ -12,7 +12,7 @@ int writePresence(const char *avail, int availlen, const char *desc, int desclen
PSYC_newModifier2(C_GLYPH_OPERATOR_SET, PSYC_C2ARG("_source"), PSYC_C2ARG(myUNI),
PSYC_MODIFIER_ROUTING),
PSYC_newModifier2(C_GLYPH_OPERATOR_SET, PSYC_C2ARG("_context"), PSYC_C2ARG(myUNI),
PSYC_MODIFIER_CHECK_LENGTH),
PSYC_MODIFIER_ROUTING),
};
PSYC_Modifier entity[] = {