glite_jp_attrval_copy()
authorAleš Křenek <ljocha@ics.muni.cz>
Fri, 26 Aug 2005 14:22:08 +0000 (14:22 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Fri, 26 Aug 2005 14:22:08 +0000 (14:22 +0000)
org.glite.jp.common/interface/attr.h
org.glite.jp.common/src/attr.c

index 0856963..2e371d8 100644 (file)
@@ -5,6 +5,7 @@
 #define GLITE_JP_ATTR_OWNER    GLITE_JP_SYSTEM_NS ":owner"
 
 void glite_jp_attrval_free(glite_jp_attrval_t *,int);
+void glite_jp_attrval_copy(glite_jp_attrval_t *,const glite_jp_attrval_t *);
 
 /* Search through registered type plugins and call appropriate plugin method.
  * See type_plugin.h for detailed description.
@@ -21,4 +22,5 @@ const char *glite_jp_attrval_db_type_index(glite_jp_context_t ctx,const char *at
 
 
 
+
 #endif
index a745fdc..c8f6ff3 100644 (file)
@@ -17,6 +17,22 @@ void glite_jp_attrval_free(glite_jp_attrval_t *a,int f)
        if (f) free(a);
 }
 
+void glite_jp_attrval_copy(glite_jp_attrval_t *dst,const glite_jp_attrval_t *src)
+{
+       dst->name = strdup(src->name);
+       dst->origin = src->origin;
+       dst->size = src->size;
+       dst->timestamp = src->timestamp;
+       dst->origin_detail = src->origin_detail ? 
+               strdup(src->origin_detail) : NULL;
+       if (dst->binary = src->binary) {
+               dst->value = malloc(src->size);
+               memcpy(dst->value,src->value,src->size);
+       }
+       else dst->value = strdup(src->value);
+}
+
+
 #define min(x,y) ((x) > (y) ? (y) : (x))
 
 static int fb_cmp(void *ctx,const glite_jp_attrval_t *a,const glite_jp_attrval_t *b,int *result)