1
0
Fork 0
mirror of git://git.psyced.org/git/psyclpc synced 2024-08-15 03:20:16 +00:00
psyclpc/src/pkg-psyc.h

41 lines
703 B
C
Raw Normal View History

#ifdef USE_PSYC
2011-05-08 19:05:54 +00:00
# ifndef PKG_PSYC_H
2011-04-26 08:02:17 +00:00
/* pkg-psyc takes and produces PSYC packets in form
* of an array of mapping, mapping, string and string
* or int* where necessary.
*/
# define PSYC_ROUTING 0
# define PSYC_ENTITY 1
# define PSYC_METHOD 2
# define PSYC_BODY 3
# include <psyc/parser.h>
2011-05-08 19:05:54 +00:00
# include "array.h"
# include "xalloc.h"
2011-05-08 14:58:35 +00:00
typedef struct {
psycParseState *parser;
vector_t *packet;
char *tmp;
size_t tmplen;
} psycState;
static inline void
2011-05-08 14:58:35 +00:00
psyc_free_parser (psycState *ps) {
if (!ps)
return;
2011-05-08 18:53:12 +00:00
if (ps->tmp)
2011-05-08 19:05:54 +00:00
pfree((void *) ps->tmp);
2011-05-08 18:53:12 +00:00
if (ps->parser)
2011-05-08 19:05:54 +00:00
pfree((void *) ps->parser);
2011-05-08 14:58:35 +00:00
if (ps->packet)
free_array(ps->packet);
}
2011-04-26 08:02:17 +00:00
2011-05-08 19:05:54 +00:00
# define PKG_PSYC_H
# endif
#endif