Implement ccl_qual_fitem2
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 27 Sep 2012 13:11:07 +0000 (15:11 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 27 Sep 2012 13:11:07 +0000 (15:11 +0200)
Like ccl_qual_fitem but with diagnostic string returned.

include/yaz/ccl.h
src/cclqfile.c

index 88deaed..dbf73e4 100644 (file)
@@ -223,6 +223,9 @@ void ccl_qual_line(CCL_bibset bibset, char *line);
 YAZ_EXPORT
 void ccl_qual_fitem(CCL_bibset bibset, const char *value,
                     const char *qual_name);
+YAZ_EXPORT
+int ccl_qual_fitem2(CCL_bibset bibset, const char *value,
+                    const char *qual_name, const char **addinfo);
 
 /** Make CCL qualifier set */
 YAZ_EXPORT
index 3d64a72..b4661b3 100644 (file)
@@ -234,12 +234,24 @@ void ccl_qual_field(CCL_bibset bibset, const char *cp, const char *qual_name)
         yaz_log(YLOG_WARN, "ccl_qual_field2 fail: %s", addinfo);
 }
 
-void ccl_qual_fitem (CCL_bibset bibset, const char *cp, const char *qual_name)
+int ccl_qual_fitem2(CCL_bibset bibset, const char *cp, const char *qual_name,
+                    const char **addinfo)
 {
     if (*qual_name == '@')
+    {
+        /* ccl_qual_add_special can not return error (yet) */
         ccl_qual_add_special(bibset, qual_name+1, cp);
+        *addinfo = 0;
+        return 0;
+    }
     else
-        ccl_qual_field(bibset, cp, qual_name);
+        return ccl_qual_field2(bibset, cp, qual_name, addinfo);
+}
+
+void ccl_qual_fitem(CCL_bibset bibset, const char *cp, const char *qual_name)
+{
+    const char *addinfo = 0;
+    ccl_qual_fitem2(bibset, cp, qual_name, &addinfo);
 }
 
 void ccl_qual_buf(CCL_bibset bibset, const char *buf)