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

c++ compat

This commit is contained in:
tg(x) 2012-02-21 03:00:52 +01:00
parent dbd2c1f19d
commit ece5c86cb4
5 changed files with 28 additions and 14 deletions

View file

@ -17,6 +17,14 @@
#ifndef PSYC_H #ifndef PSYC_H
#define PSYC_H #define PSYC_H
#ifdef __cplusplus
extern "C"
{
#if 0 /* keep Emacsens' auto-indent happy */
}
#endif
#endif
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
@ -72,4 +80,11 @@ typedef struct {
#include "psyc/text.h" #include "psyc/text.h"
#include "psyc/uniform.h" #include "psyc/uniform.h"
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
#ifdef __cplusplus
}
#endif
#endif #endif

View file

@ -45,7 +45,7 @@ psyc_map_lookup (const PsycMap *map, size_t size,
* @see psyc_map_lookup * @see psyc_map_lookup
*/ */
static inline intptr_t static inline intptr_t
psyc_map_lookup_int (const PsycMapInt * map, size_t size, psyc_map_lookup_int (const PsycMapInt *map, size_t size,
const char *key, size_t keylen, PsycBool inherit) const char *key, size_t keylen, PsycBool inherit)
{ {
return (intptr_t) psyc_map_lookup((PsycMap *) map, size, key, keylen, inherit); return (intptr_t) psyc_map_lookup((PsycMap *) map, size, key, keylen, inherit);

View file

@ -256,17 +256,15 @@ psyc_modifier_init (PsycModifier *m, PsycOperator oper,
char *name, size_t namelen, char *name, size_t namelen,
char *value, size_t valuelen, PsycModifierFlag flag) char *value, size_t valuelen, PsycModifierFlag flag)
{ {
*m = (PsycModifier) { m->oper = oper;
.oper = oper, m->name = (PsycString){namelen, name};
.name = {namelen, name}, m->value = (PsycString){valuelen, value};
.value = {valuelen, value}, m->flag = flag;
.flag = flag
};
if (flag == PSYC_MODIFIER_CHECK_LENGTH) // find out if it needs a length if (flag == PSYC_MODIFIER_CHECK_LENGTH) // find out if it needs a length
m->flag = psyc_modifier_length_check(m); m->flag = psyc_modifier_length_check(m);
else if (flag & PSYC_MODIFIER_ROUTING) else if (flag & PSYC_MODIFIER_ROUTING)
m->flag |= PSYC_MODIFIER_NO_LENGTH; m->flag = (PsycModifierFlag)(m->flag | PSYC_MODIFIER_NO_LENGTH);
} }
/** /**

View file

@ -611,7 +611,7 @@ psyc_parse_content_length (PsycParseState *state)
static inline PsycBool static inline PsycBool
psyc_parse_content_length_found (PsycParseState *state) psyc_parse_content_length_found (PsycParseState *state)
{ {
return state->contentlen_found; return (PsycBool) state->contentlen_found;
} }
static inline size_t static inline size_t
@ -623,7 +623,7 @@ psyc_parse_value_length (PsycParseState *state)
static inline PsycBool static inline PsycBool
psyc_parse_value_length_found (PsycParseState *state) psyc_parse_value_length_found (PsycParseState *state)
{ {
return state->valuelen_found; return (PsycBool) state->valuelen_found;
} }
static inline size_t static inline size_t

View file

@ -72,7 +72,8 @@ static inline PsycRoutingVar
psyc_var_routing (const char *name, size_t len) psyc_var_routing (const char *name, size_t len)
{ {
return (PsycRoutingVar) return (PsycRoutingVar)
psyc_map_lookup((PsycMap*)psyc_rvars, psyc_rvars_num, name, len, PSYC_NO); psyc_map_lookup_int((PsycMapInt*)psyc_rvars, psyc_rvars_num, name, len,
PSYC_NO);
} }
/** /**
@ -82,7 +83,7 @@ static inline PsycType
psyc_var_type (const char *name, size_t len) psyc_var_type (const char *name, size_t len)
{ {
return (PsycType) return (PsycType)
psyc_map_lookup((PsycMap*)psyc_var_types, psyc_var_types_num, psyc_map_lookup_int((PsycMapInt*)psyc_var_types, psyc_var_types_num,
name, len, PSYC_YES); name, len, PSYC_YES);
} }