From 2f592653388f6d3428a6d08ba20b63ae069313af Mon Sep 17 00:00:00 2001 From: "psyc://psyced.org/~lynX" <@> Date: Wed, 20 Apr 2011 15:36:56 +0200 Subject: [PATCH] typedef my enum! --- include/psyc.h | 4 ++-- include/psyc/parser.h | 10 ++++++---- src/match.c | 10 +++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/psyc.h b/include/psyc.h index 3055da0..a0bb5bb 100644 --- a/include/psyc.h +++ b/include/psyc.h @@ -23,8 +23,8 @@ /** @brief Checks if short keyword string matches long keyword string */ -int PSYC_matches(uint8_t* sho, size_t slen, - uint8_t* lon, size_t llen); +int PSYC_matches(char* sho, size_t slen, + char* lon, size_t llen); /** @brief Callback for PSYC_text() that produces a value for a match * diff --git a/include/psyc/parser.h b/include/psyc/parser.h index 23ba5fc..5c4398e 100644 --- a/include/psyc/parser.h +++ b/include/psyc/parser.h @@ -20,10 +20,12 @@ /** Different types that a variable can have * - * This enum lists all the types that a variable - * in a psyc packet can have + * This enum lists PSYC variable types that + * this library is capable of checking for + * validity. Other variable types are treated + * as opaque data. */ -enum PSYC_Types { +typedef enum { PSYC_TYPE_AMOUNT, PSYC_TYPE_COLOR, PSYC_TYPE_DATE, @@ -36,7 +38,7 @@ enum PSYC_Types { PSYC_TYPE_PAGE, PSYC_TYPE_UNIFORM, PSYC_TYPE_TIME, -}; +} PSYC_Type; enum PSYC_Flags { diff --git a/src/match.c b/src/match.c index 8b159f4..1292c25 100644 --- a/src/match.c +++ b/src/match.c @@ -2,9 +2,9 @@ /* TODO: PSYC_inherits() */ -int PSYC_matches(uint8_t* sho, size_t slen, - uint8_t* lon, size_t llen) { - uint8_t *s, *l, *se, *le; +int PSYC_matches(char* sho, size_t slen, + char* lon, size_t llen) { + char *s, *l, *se, *le; if (!slen) slen = strlen(sho); if (!llen) llen = strlen(lon); @@ -35,10 +35,10 @@ int PSYC_matches(uint8_t* sho, size_t slen, /* doesn't always work this way.. FIXME */ *se = *le = '_'; sho++; lon++; - while(s = strchr(sho, '_')) { + while((s = strchr(sho, '_'))) { *s = 0; PT(("sho goes '%c' and lon goes '%c'\n", *sho, *lon)) - while(l = strchr(lon, '_')) { + while((l = strchr(lon, '_'))) { *l = 0; PT(("strcmp short '%s' long '%s'\n", sho, lon)) if (!strcmp(sho, lon)) goto foundone;