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

uniform - added 'valid' member; macro fix

This commit is contained in:
tg(x) 2011-10-23 00:13:42 +02:00
parent 825a383772
commit 47984a765b
3 changed files with 8 additions and 5 deletions

View file

@ -22,10 +22,10 @@
#define PSYC_EPOCH 1440444041 // 2015-08-24 21:20:41 CET (Monday) #define PSYC_EPOCH 1440444041 // 2015-08-24 21:20:41 CET (Monday)
#define PSYC_C2STR(string) {sizeof(string)-1, string} #define PSYC_C2STR(str) {sizeof(str)-1, str}
#define PSYC_C2ARG(string) string, sizeof(string)-1 #define PSYC_C2ARG(str) str, sizeof(str)-1
#define PSYC_S2ARG(string) string.ptr, string.length #define PSYC_S2ARG(str) (str).ptr, (str).length
#define PSYC_S2ARG2(string) string.length, string.ptr #define PSYC_S2ARG2(str) (str).length, (str).ptr
typedef enum typedef enum
{ {
@ -92,7 +92,7 @@ typedef struct
/// Length of the data pointed to by ptr /// Length of the data pointed to by ptr
size_t length; size_t length;
/// pointer to the data /// pointer to the data
const char *ptr; char *ptr;
} psycString; } psycString;
typedef struct typedef struct

View file

@ -15,6 +15,7 @@ typedef enum {
typedef struct { typedef struct {
// essential parts // essential parts
uint8_t valid;
psycScheme type; psycScheme type;
psycString scheme; psycString scheme;
psycString user; psycString user;

View file

@ -9,6 +9,7 @@ int psyc_parseUniform2 (psycUniform *uni, const char *str, size_t length)
psycString *p; psycString *p;
size_t pos = 0, part = PSYC_UNIFORM_SCHEME; size_t pos = 0, part = PSYC_UNIFORM_SCHEME;
uni->valid = 0;
uni->full.ptr = str; uni->full.ptr = str;
uni->full.length = length; uni->full.length = length;
@ -161,6 +162,7 @@ int psyc_parseUniform2 (psycUniform *uni, const char *str, size_t length)
if (uni->host.length == 0) if (uni->host.length == 0)
return PSYC_PARSE_UNIFORM_INVALID_HOST; return PSYC_PARSE_UNIFORM_INVALID_HOST;
uni->valid = 1;
return uni->type; return uni->type;
} }