added glite_jp_attrval_free()
authorAleš Křenek <ljocha@ics.muni.cz>
Tue, 26 Apr 2005 14:12:37 +0000 (14:12 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Tue, 26 Apr 2005 14:12:37 +0000 (14:12 +0000)
org.glite.jp.common/Makefile
org.glite.jp.common/interface/types.h
org.glite.jp.common/src/attr.c [new file with mode: 0644]

index 8626261..3f84bcd 100644 (file)
@@ -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
index e5af0f5..fb0a0e5 100644 (file)
@@ -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 (file)
index 0000000..fcef59c
--- /dev/null
@@ -0,0 +1,18 @@
+#include <stdlib.h>
+
+#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);
+}