New upstream version 24.0.1+dfsg1
This commit is contained in:
parent
b14f9eae6d
commit
5a730d6ec3
842 changed files with 42245 additions and 33385 deletions
|
|
@ -81,7 +81,7 @@ static struct text_node *text_node_bychar(struct text_node *node, char ch)
|
|||
}
|
||||
|
||||
static struct text_node *text_node_byname(struct text_node *node,
|
||||
const char *name)
|
||||
const char *name)
|
||||
{
|
||||
struct text_node *subnode = node->first_subnode;
|
||||
|
||||
|
|
@ -102,8 +102,8 @@ struct text_lookup {
|
|||
struct text_node *top;
|
||||
};
|
||||
|
||||
static void lookup_createsubnode(const char *lookup_val,
|
||||
struct text_leaf *leaf, struct text_node *node)
|
||||
static void lookup_createsubnode(const char *lookup_val, struct text_leaf *leaf,
|
||||
struct text_node *node)
|
||||
{
|
||||
struct text_node *new = bzalloc(sizeof(struct text_node));
|
||||
new->leaf = leaf;
|
||||
|
|
@ -114,11 +114,11 @@ static void lookup_createsubnode(const char *lookup_val,
|
|||
}
|
||||
|
||||
static void lookup_splitnode(const char *lookup_val, size_t len,
|
||||
struct text_leaf *leaf, struct text_node *node)
|
||||
struct text_leaf *leaf, struct text_node *node)
|
||||
{
|
||||
struct text_node *split = bzalloc(sizeof(struct text_node));
|
||||
|
||||
dstr_copy(&split->str, node->str.array+len);
|
||||
dstr_copy(&split->str, node->str.array + len);
|
||||
split->leaf = node->leaf;
|
||||
split->first_subnode = node->first_subnode;
|
||||
node->first_subnode = split;
|
||||
|
|
@ -127,21 +127,21 @@ static void lookup_splitnode(const char *lookup_val, size_t len,
|
|||
|
||||
if (lookup_val[len] != 0) {
|
||||
node->leaf = NULL;
|
||||
lookup_createsubnode(lookup_val+len, leaf, node);
|
||||
lookup_createsubnode(lookup_val + len, leaf, node);
|
||||
} else {
|
||||
node->leaf = leaf;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void lookup_replaceleaf(struct text_node *node,
|
||||
struct text_leaf *leaf)
|
||||
struct text_leaf *leaf)
|
||||
{
|
||||
text_leaf_destroy(node->leaf);
|
||||
node->leaf = leaf;
|
||||
}
|
||||
|
||||
static void lookup_addstring(const char *lookup_val, struct text_leaf *leaf,
|
||||
struct text_node *node)
|
||||
struct text_node *node)
|
||||
{
|
||||
struct text_node *child;
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ static void lookup_addstring(const char *lookup_val, struct text_leaf *leaf,
|
|||
|
||||
for (len = 0; len < child->str.len; len++) {
|
||||
char val1 = child->str.array[len],
|
||||
val2 = lookup_val[len];
|
||||
val2 = lookup_val[len];
|
||||
|
||||
if (val1 >= 'A' && val1 <= 'Z')
|
||||
val1 += 0x20;
|
||||
|
|
@ -169,7 +169,7 @@ static void lookup_addstring(const char *lookup_val, struct text_leaf *leaf,
|
|||
}
|
||||
|
||||
if (len == child->str.len) {
|
||||
lookup_addstring(lookup_val+len, leaf, child);
|
||||
lookup_addstring(lookup_val + len, leaf, child);
|
||||
return;
|
||||
} else {
|
||||
lookup_splitnode(lookup_val, len, leaf, child);
|
||||
|
|
@ -182,7 +182,7 @@ static void lookup_addstring(const char *lookup_val, struct text_leaf *leaf,
|
|||
static void lookup_getstringtoken(struct lexer *lex, struct strref *token)
|
||||
{
|
||||
const char *temp = lex->offset;
|
||||
bool was_backslash = false;
|
||||
bool was_backslash = false;
|
||||
|
||||
while (*temp != 0 && *temp != '\n') {
|
||||
if (!was_backslash) {
|
||||
|
|
@ -205,7 +205,7 @@ static void lookup_getstringtoken(struct lexer *lex, struct strref *token)
|
|||
token->array++;
|
||||
token->len--;
|
||||
|
||||
if (*(temp-1) == '"')
|
||||
if (*(temp - 1) == '"')
|
||||
token->len--;
|
||||
}
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ static bool lookup_gettoken(struct lexer *lex, struct strref *str)
|
|||
if (!str->array) {
|
||||
/* comments are designated with a #, and end at LF */
|
||||
if (ch == '#') {
|
||||
while(ch != '\n' && ch != 0)
|
||||
while (ch != '\n' && ch != 0)
|
||||
ch = *(++lex->offset);
|
||||
} else if (temp.type == BASETOKEN_WHITESPACE) {
|
||||
strref_copy(str, &temp.text);
|
||||
|
|
@ -280,9 +280,9 @@ static inline bool lookup_goto_nextline(struct lexer *p)
|
|||
static char *convert_string(const char *str, size_t len)
|
||||
{
|
||||
struct dstr out;
|
||||
out.array = bstrdup_n(str, len);
|
||||
out.capacity = len+1;
|
||||
out.len = len;
|
||||
out.array = bstrdup_n(str, len);
|
||||
out.capacity = len + 1;
|
||||
out.len = len;
|
||||
|
||||
dstr_replace(&out, "\\n", "\n");
|
||||
dstr_replace(&out, "\\t", "\t");
|
||||
|
|
@ -293,7 +293,7 @@ static char *convert_string(const char *str, size_t len)
|
|||
}
|
||||
|
||||
static void lookup_addfiledata(struct text_lookup *lookup,
|
||||
const char *file_data)
|
||||
const char *file_data)
|
||||
{
|
||||
struct lexer lex;
|
||||
struct strref name, value;
|
||||
|
|
@ -309,7 +309,7 @@ static void lookup_addfiledata(struct text_lookup *lookup,
|
|||
|
||||
if (*name.array == '\n')
|
||||
continue;
|
||||
getval:
|
||||
getval:
|
||||
if (!lookup_gettoken(&lex, &value))
|
||||
break;
|
||||
if (*value.array == '\n')
|
||||
|
|
@ -320,8 +320,8 @@ getval:
|
|||
}
|
||||
|
||||
leaf = bmalloc(sizeof(struct text_leaf));
|
||||
leaf->lookup = bstrdup_n(name.array, name.len);
|
||||
leaf->value = convert_string(value.array, value.len);
|
||||
leaf->lookup = bstrdup_n(name.array, name.len);
|
||||
leaf->value = convert_string(value.array, value.len);
|
||||
|
||||
lookup_addstring(leaf->lookup, leaf, lookup->top);
|
||||
|
||||
|
|
@ -332,8 +332,8 @@ getval:
|
|||
lexer_free(&lex);
|
||||
}
|
||||
|
||||
static inline bool lookup_getstring(const char *lookup_val,
|
||||
const char **out, struct text_node *node)
|
||||
static inline bool lookup_getstring(const char *lookup_val, const char **out,
|
||||
struct text_node *node)
|
||||
{
|
||||
struct text_node *child;
|
||||
char ch;
|
||||
|
|
@ -409,7 +409,7 @@ void text_lookup_destroy(lookup_t *lookup)
|
|||
}
|
||||
|
||||
bool text_lookup_getstr(lookup_t *lookup, const char *lookup_val,
|
||||
const char **out)
|
||||
const char **out)
|
||||
{
|
||||
if (lookup)
|
||||
return lookup_getstring(lookup_val, out, lookup->top);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue