1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

added assert for render, removed LPC assert

This commit is contained in:
Gabor Adam Toth 2011-04-25 22:31:21 +02:00
parent d1d4e3c516
commit a253f96283
4 changed files with 6 additions and 16 deletions

View file

@ -3,7 +3,7 @@
#ifdef DEBUG #ifdef DEBUG
# include <stdio.h> # include <stdio.h>
# define PP(args) printf args; # define PP(args) printf(args);
#else #else
# define PP(args) # define PP(args)
#endif #endif
@ -82,18 +82,4 @@
# define P4(MSG) # define P4(MSG)
#endif #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 #endif // DEBUG_H

View file

@ -6,6 +6,7 @@
#include "../psyc.h" #include "../psyc.h"
#include "./debug.h" #include "./debug.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <assert.h>
/* perlisms for readability */ /* perlisms for readability */
#define unless(COND) if (!(COND)) #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); memcpy(buffer + cur, PSYC_PACKET_DELIMITER + 1, 2);
cur += 2;
assert(cur == packet->length);
return PSYC_RENDER_SUCCESS; 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_newModifier2(C_GLYPH_OPERATOR_SET, PSYC_C2ARG("_source"), PSYC_C2ARG(myUNI),
PSYC_MODIFIER_ROUTING), PSYC_MODIFIER_ROUTING),
PSYC_newModifier2(C_GLYPH_OPERATOR_SET, PSYC_C2ARG("_context"), PSYC_C2ARG(myUNI), PSYC_newModifier2(C_GLYPH_OPERATOR_SET, PSYC_C2ARG("_context"), PSYC_C2ARG(myUNI),
PSYC_MODIFIER_CHECK_LENGTH), PSYC_MODIFIER_ROUTING),
}; };
PSYC_Modifier entity[] = { PSYC_Modifier entity[] = {