From 053ac2276a88649fac10dfc4ce3b011eaf218def Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Tue, 26 Apr 2005 14:12:37 +0000 Subject: [PATCH] added glite_jp_attrval_free() --- org.glite.jp.common/Makefile | 2 +- org.glite.jp.common/interface/types.h | 6 ++++-- org.glite.jp.common/src/attr.c | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 org.glite.jp.common/src/attr.c 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); +} -- 1.8.2.3