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

View file

@ -45,7 +45,7 @@ psyc_map_lookup (const PsycMap *map, size_t size,
* @see psyc_map_lookup
*/
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)
{
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 *value, size_t valuelen, PsycModifierFlag flag)
{
*m = (PsycModifier) {
.oper = oper,
.name = {namelen, name},
.value = {valuelen, value},
.flag = flag
};
m->oper = oper;
m->name = (PsycString){namelen, name};
m->value = (PsycString){valuelen, value};
m->flag = flag;
if (flag == PSYC_MODIFIER_CHECK_LENGTH) // find out if it needs a length
m->flag = psyc_modifier_length_check(m);
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
psyc_parse_content_length_found (PsycParseState *state)
{
return state->contentlen_found;
return (PsycBool) state->contentlen_found;
}
static inline size_t
@ -623,7 +623,7 @@ psyc_parse_value_length (PsycParseState *state)
static inline PsycBool
psyc_parse_value_length_found (PsycParseState *state)
{
return state->valuelen_found;
return (PsycBool) state->valuelen_found;
}
static inline size_t

View file

@ -72,7 +72,8 @@ static inline PsycRoutingVar
psyc_var_routing (const char *name, size_t len)
{
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)
{
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);
}