Trimming of the feeded values, cleanup.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 14 May 2008 16:01:35 +0000 (16:01 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 14 May 2008 16:01:35 +0000 (16:01 +0000)
org.glite.jp.index/examples/jpis-client.c
org.glite.jp.index/src/common.c
org.glite.jp.index/src/common.h
org.glite.jp.index/src/db_ops.c

index a8eb355..6e1a26a 100644 (file)
@@ -174,9 +174,9 @@ static int query_recv(struct soap *soap, int fd, struct _jpelem__QueryJobs *qj)
 
        /* strip white-space characters from attributes */
        for (i = 0; i < qj->__sizeattributes; i++)
-               glite_jpis_trim_soap(soap, &qj->attributes[i]);
+               glite_jpis_trim(qj->attributes[i]);
        for (i = 0; i < qj->__sizeconditions; i++)
-               glite_jpis_trim_soap(soap, &GLITE_SECURITY_GSOAP_LIST_GET(qj->conditions, i)->attr);
+               glite_jpis_trim(GLITE_SECURITY_GSOAP_LIST_GET(qj->conditions, i)->attr);
 
        return 0;
 }
index caa0f89..f6e8291 100644 (file)
 #define WHITE_SPACE_SET "\n\r \t"
 
 
-void glite_jpis_trim_soap(struct soap *soap, char **soap_str) {
+void glite_jpis_trim(char *str) {
        size_t pos, len;
-       char *s;
 
-       if (!*soap_str) return;
+       if (!str) return;
 
-       pos = strspn(*soap_str, WHITE_SPACE_SET);
-       len = strcspn(*soap_str + pos, WHITE_SPACE_SET);
-       s = soap_malloc(soap, len + 1);
-       memcpy(s, *soap_str + pos, len);
-       s[len] = '\0';
-
-       soap_dealloc(soap, *soap_str);
-       *soap_str = s;
+       pos = strspn(str, WHITE_SPACE_SET);
+       len = strcspn(str + pos, WHITE_SPACE_SET);
+       if (pos) memmove(str, str + pos, len);
+       str[len] = '\0';
 }
 
 
index 4a38bb8..c0756c2 100644 (file)
@@ -6,7 +6,7 @@
 #include <glite/jp/types.h>
 #include <glite/jp/context.h>
 
-void glite_jpis_trim_soap(struct soap *soap, char **soap_str);
+void glite_jpis_trim(char *str);
 
 int glite_jpis_stack_error_source(glite_jp_context_t ctx, int code, const char *func, int line, const char *desc, ...);
 
index c642097..ad465a9 100644 (file)
@@ -748,9 +748,11 @@ int glite_jpis_feeding(glite_jpis_context_t ctx, const char *fname, const char *
                                avs[i].name = ctx->conf->attrs[iname];
                                iname++;
                        } while (strcasecmp(avs[i].name, GLITE_JP_ATTR_JOBID) == 0 || strcasecmp(avs[i].name, GLITE_JP_ATTR_OWNER) == 0);
+                       glite_jpis_trim(token);
                        avs[i].value = token;
                        avs[i].timestamp = time(NULL);
-//                     printf(stderr, "\t %d: %s = '%s'\n", i, avs[i].name, avs[i].value);
+                       avs[i].origin = GLITE_JP_ATTR_ORIG_FILE;
+//                     printf("\t %d: %s = '%s'\n", i, avs[i].name, avs[i].value);
                        i++;
 
                        token = strtok_r(NULL, FEEDING_SEPARATORS, &lasts);