tests CHANGE speedup building
Instead of including C source files and bilding each test from the
sources, use shared library objects and link them into the resulting
test executable.
Maintaining list of included C source files was unmaintainable with the
increasing number of source files and dependencies between them.
diff --git a/src/hash_table.c b/src/hash_table.c
index 5e48332..f26d04c 100644
--- a/src/hash_table.c
+++ b/src/hash_table.c
@@ -244,7 +244,7 @@
return result;
}
-static struct ht_rec *
+struct ht_rec *
lyht_get_rec(unsigned char *recs, uint16_t rec_size, uint32_t idx)
{
return (struct ht_rec *)&recs[idx * rec_size];
diff --git a/src/parser_yang.c b/src/parser_yang.c
index 7ef4968..d274fde 100644
--- a/src/parser_yang.c
+++ b/src/parser_yang.c
@@ -119,12 +119,12 @@
#define YANG_CHECK_STMTVER2_RET(CTX, KW, PARENT) \
if ((CTX)->mod_version < 2) {LOGVAL_YANG((CTX), LY_VCODE_INCHILDSTMT2, KW, PARENT); return LY_EVALID;}
-static LY_ERR parse_container(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
-static LY_ERR parse_uses(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
-static LY_ERR parse_choice(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
-static LY_ERR parse_case(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
-static LY_ERR parse_list(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
-static LY_ERR parse_grouping(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_grp **groupings);
+LY_ERR parse_container(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_uses(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_choice(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_case(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_list(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings);
+LY_ERR parse_grouping(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_grp **groupings);
/**
* @brief Add another character to dynamic buffer, a low-level function.
@@ -140,7 +140,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
buf_add_char(struct ly_ctx *ctx, const char **input, size_t len, char **buf, size_t *buf_len, size_t *buf_used)
{
if (*buf_len <= (*buf_used) + len) {
@@ -191,7 +191,7 @@
* If the identifier cannot be prefixed, NULL is expected.
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
check_identifierchar(struct lys_parser_ctx *ctx, unsigned int c, int first, int *prefix)
{
if (first || (prefix && (*prefix) == 1)) {
@@ -232,7 +232,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
buf_store_char(struct lys_parser_ctx *ctx, const char **input, enum yang_arg arg,
char **word_p, size_t *word_len, char **word_b, size_t *buf_len, int need_buf)
{
@@ -316,7 +316,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
skip_comment(struct lys_parser_ctx *ctx, const char **data, int comment)
{
/* internal statuses: 0 - comment ended,
@@ -581,7 +581,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
get_argument(struct lys_parser_ctx *ctx, const char **data, enum yang_arg arg,
uint16_t *flags, char **word_p, char **word_b, size_t *word_len)
{
@@ -696,7 +696,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
get_keyword(struct lys_parser_ctx *ctx, const char **data, enum yang_keyword *kw, char **word_p, size_t *word_len)
{
int prefix;
@@ -1776,7 +1776,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_any(struct lys_parser_ctx *ctx, const char **data, enum yang_keyword kw, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
@@ -2342,7 +2342,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_leaf(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
@@ -2440,7 +2440,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_maxelements(struct lys_parser_ctx *ctx, const char **data, uint32_t *max, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
@@ -2507,7 +2507,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_minelements(struct lys_parser_ctx *ctx, const char **data, uint32_t *min, uint16_t *flags, struct lysp_ext_instance **exts)
{
LY_ERR ret = LY_SUCCESS;
@@ -2619,7 +2619,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_leaflist(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
@@ -2948,7 +2948,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_action(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_action **actions)
{
LY_ERR ret = LY_SUCCESS;
@@ -3021,7 +3021,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_notif(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_notif **notifs)
{
LY_ERR ret = LY_SUCCESS;
@@ -3116,7 +3116,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_grouping(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_grp **groupings)
{
LY_ERR ret = LY_SUCCESS;
@@ -3212,7 +3212,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_augment(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_augment **augments)
{
LY_ERR ret = LY_SUCCESS;
@@ -3303,7 +3303,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_uses(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
@@ -3376,7 +3376,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_case(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
@@ -3467,7 +3467,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_choice(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
@@ -3574,7 +3574,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_container(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = 0;
@@ -3696,7 +3696,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_list(struct lys_parser_ctx *ctx, const char **data, struct lysp_node *parent, struct lysp_node **siblings)
{
LY_ERR ret = LY_SUCCESS;
@@ -3982,7 +3982,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_deviate(struct lys_parser_ctx *ctx, const char **data, struct lysp_deviate **deviates)
{
LY_ERR ret = LY_SUCCESS;
@@ -4196,7 +4196,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_deviation(struct lys_parser_ctx *ctx, const char **data, struct lysp_deviation **deviations)
{
LY_ERR ret = LY_SUCCESS;
@@ -4250,7 +4250,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_feature(struct lys_parser_ctx *ctx, const char **data, struct lysp_feature **features)
{
LY_ERR ret = LY_SUCCESS;
@@ -4299,7 +4299,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_identity(struct lys_parser_ctx *ctx, const char **data, struct lysp_ident **identities)
{
LY_ERR ret = LY_SUCCESS;
@@ -4382,7 +4382,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_module(struct lys_parser_ctx *ctx, const char **data, struct lysp_module *mod)
{
LY_ERR ret = 0;
@@ -4592,7 +4592,7 @@
*
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
parse_submodule(struct lys_parser_ctx *ctx, const char **data, struct lysp_submodule *submod)
{
LY_ERR ret = 0;
diff --git a/src/tree_schema_compile.c b/src/tree_schema_compile.c
index 2f9246c..1c3b017 100644
--- a/src/tree_schema_compile.c
+++ b/src/tree_schema_compile.c
@@ -2184,7 +2184,7 @@
* @param[out] has_predicate Flag to mark whether there is a predicate specified.
* @return LY_ERR value: LY_SUCCESS or LY_EINVAL in case of invalid character in the path.
*/
-static LY_ERR
+LY_ERR
lys_path_token(const char **path, const char **prefix, size_t *prefix_len, const char **name, size_t *name_len,
int *parent_times, int *has_predicate)
{
diff --git a/src/tree_schema_free.c b/src/tree_schema_free.c
index 283ba29..546b4d2 100644
--- a/src/tree_schema_free.c
+++ b/src/tree_schema_free.c
@@ -22,8 +22,8 @@
#include "tree_schema_internal.h"
#include "xpath.h"
-static void lysp_grp_free(struct ly_ctx *ctx, struct lysp_grp *grp);
-static void lysp_node_free(struct ly_ctx *ctx, struct lysp_node *node);
+void lysp_grp_free(struct ly_ctx *ctx, struct lysp_grp *grp);
+void lysp_node_free(struct ly_ctx *ctx, struct lysp_node *node);
static void
lysp_stmt_free(struct ly_ctx *ctx, struct lysp_stmt *stmt)
@@ -40,7 +40,7 @@
free(stmt);
}
-static void
+void
lysp_ext_instance_free(struct ly_ctx *ctx, struct lysp_ext_instance *ext)
{
struct lysp_stmt *stmt, *next;
@@ -94,7 +94,7 @@
FREE_ARRAY(ctx, ext->exts, lysp_ext_instance_free);
}
-static void
+void
lysp_feature_free(struct ly_ctx *ctx, struct lysp_feature *feat)
{
FREE_STRING(ctx, feat->name);
@@ -104,7 +104,7 @@
FREE_ARRAY(ctx, feat->exts, lysp_ext_instance_free);
}
-static void
+void
lysp_ident_free(struct ly_ctx *ctx, struct lysp_ident *ident)
{
FREE_STRING(ctx, ident->name);
@@ -184,7 +184,7 @@
}
-static void
+void
lysp_action_free(struct ly_ctx *ctx, struct lysp_action *action)
{
FREE_STRING(ctx, action->name);
@@ -198,7 +198,7 @@
FREE_ARRAY(ctx, action->exts, lysp_ext_instance_free);
}
-static void
+void
lysp_notif_free(struct ly_ctx *ctx, struct lysp_notif *notif)
{
struct lysp_node *node, *next;
@@ -216,7 +216,7 @@
FREE_ARRAY(ctx, notif->exts, lysp_ext_instance_free);
}
-static void
+void
lysp_grp_free(struct ly_ctx *ctx, struct lysp_grp *grp)
{
struct lysp_node *node, *next;
@@ -243,7 +243,7 @@
FREE_ARRAY(ctx, when->exts, lysp_ext_instance_free);
}
-static void
+void
lysp_augment_free(struct ly_ctx *ctx, struct lysp_augment *augment)
{
struct lysp_node *node, *next;
@@ -261,7 +261,7 @@
FREE_ARRAY(ctx, augment->exts, lysp_ext_instance_free);
}
-static void
+void
lysp_deviate_free(struct ly_ctx *ctx, struct lysp_deviate *d)
{
struct lysp_deviate_add *add = (struct lysp_deviate_add*)d;
@@ -290,7 +290,7 @@
}
}
-static void
+void
lysp_deviation_free(struct ly_ctx *ctx, struct lysp_deviation *dev)
{
struct lysp_deviate *next, *iter;
@@ -318,7 +318,7 @@
FREE_ARRAY(ctx, ref->exts, lysp_ext_instance_free);
}
-static void
+void
lysp_node_free(struct ly_ctx *ctx, struct lysp_node *node)
{
struct lysp_node *child, *next;
@@ -520,7 +520,7 @@
FREE_ARRAY(ctx, ident->exts, lysc_ext_instance_free);
}
-static void
+void
lysc_feature_free(struct ly_ctx *ctx, struct lysc_feature *feat)
{
FREE_STRING(ctx, feat->name);
diff --git a/src/tree_schema_internal.h b/src/tree_schema_internal.h
index 2f5c063..2ef0817 100644
--- a/src/tree_schema_internal.h
+++ b/src/tree_schema_internal.h
@@ -15,6 +15,11 @@
#ifndef LY_TREE_SCHEMA_INTERNAL_H_
#define LY_TREE_SCHEMA_INTERNAL_H_
+#include <stdint.h>
+
+#include "set.h"
+#include "tree_schema.h"
+
#define LOGVAL_YANG(CTX, ...) LOGVAL((CTX)->ctx, LY_VLOG_LINE, &(CTX)->line, __VA_ARGS__)
/* These 2 macros checks YANG's identifier grammar rule */
diff --git a/src/xml.c b/src/xml.c
index 89fc353..9de0565 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -186,7 +186,7 @@
* work with the pointer when the function succeeds. In case of error the value is freed.
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
lyxml_ns_add(struct lyxml_context *context, const char *prefix, size_t prefix_len, char *uri)
{
struct lyxml_ns *ns;
@@ -218,7 +218,7 @@
* @param[in] context XML context to work with.
* @return LY_ERR values.
*/
-static LY_ERR
+LY_ERR
lyxml_ns_rm(struct lyxml_context *context)
{
unsigned int u;