/*
* builtin.c: builtin primitives
*
- * Copyright (C) 2007-2011 David Lutterkort
+ * Copyright (C) 2007-2016 David Lutterkort
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
static struct value *make_pathx_exn(struct info *info, struct pathx *p) {
struct value *v;
char *msg;
- const char *txt;
+ const char *txt, *px_err;
int pos;
- msg = strdup(pathx_error(p, &txt, &pos));
- if (msg == NULL)
- return NULL;
+ px_err = pathx_error(p, &txt, &pos);
+ v = make_exn_value(ref(info), "syntax error in path expression: %s",
+ px_err);
- v = make_exn_value(ref(info), "syntax error in path expression: %s", msg);
if (ALLOC_N(msg, strlen(txt) + 4) >= 0) {
strncpy(msg, txt, pos);
strcat(msg, "|=|");
if (pathx_parse(tree->origin, info->error, path->string->str, true,
NULL, NULL, p) != PATHX_NOERROR) {
- return make_pathx_exn(ref(info), *p);
+ return make_pathx_exn(info, *p);
} else {
return NULL;
}