save
[protos/libecoli.git] / lib / ecoli_strvec.c
index 3cc2055..7011cf3 100644 (file)
@@ -43,7 +43,7 @@ struct ec_strvec {
        struct ec_strvec_elt **vec;
 };
 
-struct ec_strvec *ec_strvec_new(void)
+struct ec_strvec *ec_strvec(void)
 {
        struct ec_strvec *strvec;
 
@@ -87,7 +87,7 @@ struct ec_strvec *ec_strvec_ndup(const struct ec_strvec *strvec, size_t off,
        struct ec_strvec *copy = NULL;
        size_t i, veclen;
 
-       copy = ec_strvec_new();
+       copy = ec_strvec();
        if (copy == NULL)
                goto fail;
 
@@ -161,14 +161,19 @@ void ec_strvec_dump(FILE *out, const struct ec_strvec *strvec)
        size_t i;
 
        if (strvec == NULL) {
-               fprintf(out, "empty strvec\n");
+               fprintf(out, "none\n");
                return;
        }
 
-       fprintf(out, "strvec:\n");
-       for (i = 0; i < ec_strvec_len(strvec); i++)
-               fprintf(out, "  %zd: %s (refcnt=%d)\n", i,
-                       strvec->vec[i]->str, strvec->vec[i]->refcnt);
+       fprintf(out, "strvec (len=%zu) [", strvec->len);
+       for (i = 0; i < ec_strvec_len(strvec); i++) {
+               if (i == 0)
+                       fprintf(out, "%s", strvec->vec[i]->str);
+               else
+                       fprintf(out, ", %s", strvec->vec[i]->str);
+       }
+       fprintf(out, "]\n");
+
 }
 
 /* XXX test case */