* See the file LICENSE for details.
*/
/**
- * \file xcqlutil.c
+ * \file cql2ccl.c
* \brief Implements CQL to XCQL conversion.
*/
#if HAVE_CONFIG_H
void *client_data);
static void pr_term(struct cql_node *cn,
- void (*pr)(const char *buf, void *client_data),
- void *client_data)
+ void (*pr)(const char *buf, void *client_data),
+ void *client_data)
{
while (cn)
{
pr(split_op, client_data);
pr(" ", client_data);
}
- return -1;
}
return 0;
}
cql_to_ccl(cn, cql_fputs, f);
}
-
+int cql_to_ccl_buf(struct cql_node *cn, char *out, int max)
+{
+ struct cql_buf_write_info info;
+ int r;
+ info.off = 0;
+ info.max = max;
+ info.buf = out;
+ r = cql_to_ccl(cn, cql_buf_write_handler, &info);
+ if (info.off >= 0)
+ info.buf[info.off] = '\0';
+ else
+ return -2; /* buffer overflow */
+ return r;
+}
/*
* Local variables: