From: Aleš Křenek Date: Tue, 26 Apr 2005 14:12:37 +0000 (+0000) Subject: added glite_jp_attrval_free() X-Git-Tag: glite-security-gsoap-plugin_R_1_1_0~17 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=053ac2276a88649fac10dfc4ce3b011eaf218def;p=jra1mw.git added glite_jp_attrval_free() --- diff --git a/org.glite.jp.common/Makefile b/org.glite.jp.common/Makefile index 8626261..3f84bcd 100644 --- a/org.glite.jp.common/Makefile +++ b/org.glite.jp.common/Makefile @@ -39,7 +39,7 @@ COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} HDRS:=types.h context.h strmd5.h -SRCS:=context.c strmd5.c +SRCS:=context.c strmd5.c attr.c OBJS:=${SRCS:.c=.lo} commonlib:= libglite_jp_common.la diff --git a/org.glite.jp.common/interface/types.h b/org.glite.jp.common/interface/types.h index e5af0f5a..fb0a0e5 100644 --- a/org.glite.jp.common/interface/types.h +++ b/org.glite.jp.common/interface/types.h @@ -5,8 +5,8 @@ typedef struct _glite_jp_error_t { int code; - char *desc; - char *source; + const char *desc; + const char *source; struct _glite_jp_error_t *reason; } glite_jp_error_t; @@ -82,4 +82,6 @@ typedef struct { } value,value2; } glite_jp_query_rec_t; +void glite_jp_attrval_free(glite_jp_attrval_t *,int); + #endif diff --git a/org.glite.jp.common/src/attr.c b/org.glite.jp.common/src/attr.c new file mode 100644 index 0000000..fcef59c --- /dev/null +++ b/org.glite.jp.common/src/attr.c @@ -0,0 +1,18 @@ +#include + +#include "types.h" + +void glite_jp_attrval_free(glite_jp_attrval_t *a,int f) +{ + free(a->attr.name); + + switch (a->attr.type) { + case GLITE_JP_ATTR_OWNER: + case GLITE_JP_ATTR_TAG: + free(a->value.s); + break; + default: break; + } + + if (f) free(a); +}