src/server/util/pblock.c

Fri, 29 Nov 2024 18:10:26 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 29 Nov 2024 18:10:26 +0100
changeset 564
f19fd264c69c
parent 556
b036ccad4b49
permissions
-rw-r--r--

fix wrong column name usage by pg prop extensions

1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
4 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * THE BSD LICENSE
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 * Redistribution and use in source and binary forms, with or without
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * modification, are permitted provided that the following conditions are met:
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 * Redistributions of source code must retain the above copyright notice, this
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * list of conditions and the following disclaimer.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * Redistributions in binary form must reproduce the above copyright notice,
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * this list of conditions and the following disclaimer in the documentation
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 * and/or other materials provided with the distribution.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * Neither the name of the nor the names of its contributors may be
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * used to endorse or promote products derived from this software without
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * specific prior written permission.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 /*
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 * pblock.c: Handles Parameter Blocks
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37 * See pblock.h for public documentation.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
38 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
39 * Rob McCool
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
40 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
41 * This code uses property lists to implement pblocks.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
42 */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
43
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
44
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
45 #include "pblock.h"
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
46 #include "plist_pvt.h"
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
47 #include "plist.h"
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
48 #include "util.h" /* util_itoa */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
49 #include "pool.h"
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50 #include "systhr.h"
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
51
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
52 #define MALLOC_POOL_HANDLE (thread_malloc_key != -1 ? (pool_handle_t *)systhread_getdata(thread_malloc_key) : getThreadMallocPool())
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
53
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
54 static int thread_malloc_key = -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
55 static int _pblock_str2pblock(const char* str, pblock* pb, PRBool lowerCase);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
56
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
57 static pool_handle_t *getThreadMallocPool()
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
58 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
59 pool_handle_t *thread_malloc_pool = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
60
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
61 thread_malloc_key = getThreadMallocKey();
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
62 if (thread_malloc_key != -1) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
63 thread_malloc_pool = (pool_handle_t *)systhread_getdata(thread_malloc_key);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
65
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
66 return thread_malloc_pool;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 /* ---------------------- pb_key static initializers ---------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 /*
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72 * pb_key
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
73 *
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
74 * Contains a precomputed hash value for a specific pblock variable name.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
75 */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
76 typedef struct pb_key pb_key;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
77 struct pb_key {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
78 const char *name;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79 int namelen;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 unsigned int hashval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 int sizendx;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 int hashndx;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83 };
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
85 #define PB_KEY_LIST_BUCKET_COUNT 0x7f // has to be (2^n - 1)
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
86
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
87 struct pb_key_list_bucket {
365
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
88 pb_key **elements;
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
89 unsigned size;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
90 };
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
91
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
92 struct pb_key_list {
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
93 struct pb_key_list_bucket buckets[PB_KEY_LIST_BUCKET_COUNT + 1];
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
94 };
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
95
365
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
96 static void _pb_key_list_insert(struct pb_key_list *hashList, unsigned int hashval, pb_key* element) {
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
97 struct pb_key_list_bucket *bucket = &hashList->buckets[hashval & PB_KEY_LIST_BUCKET_COUNT];
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
98 size_t idx = bucket->size;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
99 bucket->size++;
365
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
100 bucket->elements = realloc(bucket->elements, sizeof(pb_key*) * bucket->size);
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
101 if (bucket->elements == NULL) abort();
365
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
102 bucket->elements[idx] = element;
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
103 }
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
104
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
105 static struct pb_key_list _pbKeys;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
106
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
107 static const pb_key *_create_key(const char *name)
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
108 {
365
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
109 /* Create a new pb_key */
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
110 pb_key *key = malloc(sizeof(pb_key));
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
111 if (key == NULL) abort();
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
112 key->name = STRDUP(name);
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
113 key->namelen = strlen(name);
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
114 key->hashval = PListHash(name);
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
115 key->sizendx = 0;
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
116 key->hashndx = key->hashval % PLSIZENDX(0);
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
117
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
118 /* Group pb_keys by hashval for later retrieval */
365
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
119 _pb_key_list_insert(&_pbKeys, key->hashval, key);
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
120
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
121 return key;
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
122 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
123
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
124 const pb_key *pb_key_accept;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
125 const pb_key *pb_key_accept_charset;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
126 const pb_key *pb_key_accept_encoding;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
127 const pb_key *pb_key_accept_language;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
128 const pb_key *pb_key_accept_ranges;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
129 const pb_key *pb_key_actual_route;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
130 const pb_key *pb_key_age;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
131 const pb_key *pb_key_always_allow_chunked;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
132 const pb_key *pb_key_always_use_keep_alive;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
133 const pb_key *pb_key_auth_cert;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
134 const pb_key *pb_key_auth_expiring;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
135 const pb_key *pb_key_auth_group;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
136 const pb_key *pb_key_auth_type;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
137 const pb_key *pb_key_auth_user;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
138 const pb_key *pb_key_authorization;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
139 const pb_key *pb_key_browser;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
140 const pb_key *pb_key_c2p_cl;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
141 const pb_key *pb_key_c2p_hl;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
142 const pb_key *pb_key_cache_info;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
143 const pb_key *pb_key_charset;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
144 const pb_key *pb_key_check_http_server;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
145 const pb_key *pb_key_ChunkedRequestBufferSize;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
146 const pb_key *pb_key_ChunkedRequestTimeout;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
147 const pb_key *pb_key_cipher;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
148 const pb_key *pb_key_clf_request;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
149 const pb_key *pb_key_cli_status;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
150 const pb_key *pb_key_client_cert_nickname;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
151 const pb_key *pb_key_client_ip;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
152 const pb_key *pb_key_close;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
153 const pb_key *pb_key_connect_timeout;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
154 const pb_key *pb_key_connection;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
155 const pb_key *pb_key_cont;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
156 const pb_key *pb_key_content_encoding;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
157 const pb_key *pb_key_content_language;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
158 const pb_key *pb_key_content_length;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
159 const pb_key *pb_key_content_location;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
160 const pb_key *pb_key_content_md5;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
161 const pb_key *pb_key_content_range;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
162 const pb_key *pb_key_content_type;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
163 const pb_key *pb_key_cookie;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
164 const pb_key *pb_key_date;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
165 const pb_key *pb_key_DATE_GMT;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
166 const pb_key *pb_key_DATE_LOCAL;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
167 const pb_key *pb_key_dir;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
168 const pb_key *pb_key_Directive;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
169 const pb_key *pb_key_dns;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
170 const pb_key *pb_key_DOCUMENT_NAME;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
171 const pb_key *pb_key_DOCUMENT_URI;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
172 const pb_key *pb_key_domain;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
173 const pb_key *pb_key_enc;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
174 const pb_key *pb_key_engine;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
175 const pb_key *pb_key_error_action;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
176 const pb_key *pb_key_error_desc;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
177 const pb_key *pb_key_error_fn;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
178 const pb_key *pb_key_escape;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
179 const pb_key *pb_key_escaped;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
180 const pb_key *pb_key_etag;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
181 const pb_key *pb_key_expect;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
182 const pb_key *pb_key_expires;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
183 const pb_key *pb_key_expr;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
184 const pb_key *pb_key_filter;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
185 const pb_key *pb_key_find_pathinfo_forward;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
186 const pb_key *pb_key_flushTimer;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
187 const pb_key *pb_key_fn;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
188 const pb_key *pb_key_from;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
189 const pb_key *pb_key_full_headers;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
190 const pb_key *pb_key_hdr;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
191 const pb_key *pb_key_host;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
192 const pb_key *pb_key_hostname;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
193 const pb_key *pb_key_if_match;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
194 const pb_key *pb_key_if_modified_since;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
195 const pb_key *pb_key_if_none_match;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
196 const pb_key *pb_key_if_range;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
197 const pb_key *pb_key_if_unmodified_since;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
198 const pb_key *pb_key_ip;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
199 const pb_key *pb_key_iponly;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
200 const pb_key *pb_key_issuer_dn;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
201 const pb_key *pb_key_jroute;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
202 const pb_key *pb_key_keep_alive;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
203 const pb_key *pb_key_keep_alive_timeout;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
204 const pb_key *pb_key_keysize;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
205 const pb_key *pb_key_lang;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
206 const pb_key *pb_key_last_modified;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
207 const pb_key *pb_key_level;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
208 const pb_key *pb_key_location;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
209 const pb_key *pb_key_lock_owner;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
210 const pb_key *pb_key_magnus_charset;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
211 const pb_key *pb_key_magnus_internal;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
212 const pb_key *pb_key_magnus_internal_dav_src;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
213 const pb_key *pb_key_magnus_internal_default_acls_only;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
214 const pb_key *pb_key_magnus_internal_error_j2ee;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
215 const pb_key *pb_key_magnus_internal_j2ee_nsapi;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
216 const pb_key *pb_key_magnus_internal_preserve_srvhdrs;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
217 const pb_key *pb_key_magnus_internal_set_request_status;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
218 const pb_key *pb_key_magnus_internal_set_response_status;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
219 const pb_key *pb_key_magnus_internal_webapp_errordesc;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
220 const pb_key *pb_key_matched_browser;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
221 const pb_key *pb_key_max_age;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
222 const pb_key *pb_key_max_forwards;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
223 const pb_key *pb_key_message;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
224 const pb_key *pb_key_method;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
225 const pb_key *pb_key_name;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
226 const pb_key *pb_key_nocache;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
227 const pb_key *pb_key_nostat;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
228 const pb_key *pb_key_ntrans_base;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
229 const pb_key *pb_key_offline_origin_addr;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
230 const pb_key *pb_key_offline_proxy_addr;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
231 const pb_key *pb_key_origin_addr;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
232 const pb_key *pb_key_p2c_cl;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
233 const pb_key *pb_key_p2c_hl;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
234 const pb_key *pb_key_p2r_cl;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
235 const pb_key *pb_key_p2r_hl;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
236 const pb_key *pb_key_parse_timeout;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
237 const pb_key *pb_key_password;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
238 const pb_key *pb_key_path;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
239 const pb_key *pb_key_PATH_INFO;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
240 const pb_key *pb_key_path_info;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
241 const pb_key *pb_key_pblock;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
242 const pb_key *pb_key_poll_interval;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
243 const pb_key *pb_key_pool; // new
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
244 const pb_key *pb_key_port;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
245 const pb_key *pb_key_ppath;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
246 const pb_key *pb_key_pragma;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
247 const pb_key *pb_key_process_request_body;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
248 const pb_key *pb_key_process_response_body;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
249 const pb_key *pb_key_protocol;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
250 const pb_key *pb_key_proxy_addr;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
251 const pb_key *pb_key_proxy_agent;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
252 const pb_key *pb_key_proxy_auth_cert;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
253 const pb_key *pb_key_proxy_authorization;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
254 const pb_key *pb_key_proxy_cipher;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
255 const pb_key *pb_key_proxy_issuer_dn;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
256 const pb_key *pb_key_proxy_jroute;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
257 const pb_key *pb_key_proxy_keysize;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
258 const pb_key *pb_key_proxy_ping;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
259 const pb_key *pb_key_proxy_request;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
260 const pb_key *pb_key_proxy_secret_keysize;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
261 const pb_key *pb_key_proxy_ssl_id;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
262 const pb_key *pb_key_proxy_user_dn;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
263 const pb_key *pb_key_query;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
264 const pb_key *pb_key_QUERY_STRING;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
265 const pb_key *pb_key_QUERY_STRING_UNESCAPED;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
266 const pb_key *pb_key_r2p_cl;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
267 const pb_key *pb_key_r2p_hl;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
268 const pb_key *pb_key_range;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
269 const pb_key *pb_key_referer;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
270 const pb_key *pb_key_reformat_request_headers;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
271 const pb_key *pb_key_remote_status;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
272 const pb_key *pb_key_request_jroute;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
273 const pb_key *pb_key_required_rights;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
274 const pb_key *pb_key_retries;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
275 const pb_key *pb_key_rewrite_content_location;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
276 const pb_key *pb_key_rewrite_host;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
277 const pb_key *pb_key_rewrite_location;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
278 const pb_key *pb_key_rewrite_set_cookie;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
279 const pb_key *pb_key_root;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
280 const pb_key *pb_key_route;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
281 const pb_key *pb_key_route_cookie;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
282 const pb_key *pb_key_route_hdr;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
283 const pb_key *pb_key_route_offline;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
284 const pb_key *pb_key_script_name;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
285 const pb_key *pb_key_secret_keysize;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
286 const pb_key *pb_key_secure;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
287 const pb_key *pb_key_server;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
288 const pb_key *pb_key_set_cookie;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
289 const pb_key *pb_key_socks_addr;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
290 const pb_key *pb_key_ssl_id;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
291 const pb_key *pb_key_ssl_unclean_shutdown;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
292 const pb_key *pb_key_status;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
293 const pb_key *pb_key_sticky_cookie;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
294 const pb_key *pb_key_sticky_param;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
295 const pb_key *pb_key_suppress_request_headers;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
296 const pb_key *pb_key_svr_status;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
297 const pb_key *pb_key_timeout;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
298 const pb_key *pb_key_to;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
299 const pb_key *pb_key_transfer_encoding;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
300 const pb_key *pb_key_transmit_timeout;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
301 const pb_key *pb_key_tunnel_non_http_response;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
302 const pb_key *pb_key_type;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
303 const pb_key *pb_key_upstream_jroute;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
304 const pb_key *pb_key_uri;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
305 const pb_key *pb_key_url;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
306 const pb_key *pb_key_url_prefix;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
307 const pb_key *pb_key_UseOutputStreamSize;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
308 const pb_key *pb_key_user;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
309 const pb_key *pb_key_user_agent;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
310 const pb_key *pb_key_user_dn;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
311 const pb_key *pb_key_validate_server_cert;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
312 const pb_key *pb_key_value;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
313 const pb_key *pb_key_vary;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
314 const pb_key *pb_key_via;
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
315 const pb_key *pb_key_warning;
386
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
316 const pb_key *pb_key_depth;
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
317 const pb_key *pb_key_if;
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
318 const pb_key *pb_key_vfs;
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
319 const pb_key *pb_key_dav;
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
320 const pb_key *pb_key_vfsclass;
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
321 const pb_key *pb_key_davclass;
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
322
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
323 NSAPI_PUBLIC void pblock_init_default_keys(void) {
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
324 pb_key_accept = _create_key("accept");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
325 pb_key_accept_charset = _create_key("accept-charset");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
326 pb_key_accept_encoding = _create_key("accept-encoding");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
327 pb_key_accept_language = _create_key("accept-language");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
328 pb_key_accept_ranges = _create_key("accept-ranges");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
329 pb_key_actual_route = _create_key("actual-route");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
330 pb_key_age = _create_key("age");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
331 pb_key_always_allow_chunked = _create_key("always-allow-chunked");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
332 pb_key_always_use_keep_alive = _create_key("always-use-keep-alive");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
333 pb_key_auth_cert = _create_key("auth-cert");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
334 pb_key_auth_expiring = _create_key("auth-expiring");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
335 pb_key_auth_group = _create_key("auth-group");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
336 pb_key_auth_type = _create_key("auth-type");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
337 pb_key_auth_user = _create_key("auth-user");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
338 pb_key_authorization = _create_key("authorization");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
339 pb_key_browser = _create_key("browser");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
340 pb_key_c2p_cl = _create_key("c2p-cl");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
341 pb_key_c2p_hl = _create_key("c2p-hl");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
342 pb_key_cache_info = _create_key("cache-info");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
343 pb_key_charset = _create_key("charset");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
344 pb_key_check_http_server = _create_key("check-http-server");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
345 pb_key_ChunkedRequestBufferSize = _create_key("ChunkedRequestBufferSize");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
346 pb_key_ChunkedRequestTimeout = _create_key("ChunkedRequestTimeout");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
347 pb_key_cipher = _create_key("cipher");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
348 pb_key_clf_request = _create_key("clf-request");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
349 pb_key_cli_status = _create_key("cli-status");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
350 pb_key_client_cert_nickname = _create_key("client-cert-nickname");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
351 pb_key_client_ip = _create_key("client-ip");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
352 pb_key_close = _create_key("close");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
353 pb_key_connect_timeout = _create_key("connect-timeout");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
354 pb_key_connection = _create_key("connection");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
355 pb_key_cont = _create_key("cont");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
356 pb_key_content_encoding = _create_key("content-encoding");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
357 pb_key_content_language = _create_key("content-language");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
358 pb_key_content_length = _create_key("content-length");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
359 pb_key_content_location = _create_key("content-location");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
360 pb_key_content_md5 = _create_key("content-md5");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
361 pb_key_content_range = _create_key("content-range");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
362 pb_key_content_type = _create_key("content-type");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
363 pb_key_cookie = _create_key("cookie");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
364 pb_key_date = _create_key("date");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
365 pb_key_DATE_GMT = _create_key("DATE_GMT");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
366 pb_key_DATE_LOCAL = _create_key("DATE_LOCAL");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
367 pb_key_dir = _create_key("dir");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
368 pb_key_Directive = _create_key("Directive");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
369 pb_key_dns = _create_key("dns");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
370 pb_key_DOCUMENT_NAME = _create_key("DOCUMENT_NAME");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
371 pb_key_DOCUMENT_URI = _create_key("DOCUMENT_URI");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
372 pb_key_domain = _create_key("domain");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
373 pb_key_enc = _create_key("enc");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
374 pb_key_engine = _create_key("engine");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
375 pb_key_error_action = _create_key("error-action");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
376 pb_key_error_desc = _create_key("error-desc");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
377 pb_key_error_fn = _create_key("error-fn");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
378 pb_key_escape = _create_key("escape");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
379 pb_key_escaped = _create_key("escaped");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
380 pb_key_etag = _create_key("etag");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
381 pb_key_expect = _create_key("expect");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
382 pb_key_expires = _create_key("expires");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
383 pb_key_expr = _create_key("expr");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
384 pb_key_filter = _create_key("filter");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
385 pb_key_find_pathinfo_forward = _create_key("find-pathinfo-forward");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
386 pb_key_flushTimer = _create_key("flushTimer");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
387 pb_key_fn = _create_key("fn");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
388 pb_key_from = _create_key("from");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
389 pb_key_full_headers = _create_key("full-headers");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
390 pb_key_hdr = _create_key("hdr");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
391 pb_key_host = _create_key("host");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
392 pb_key_hostname = _create_key("hostname");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
393 pb_key_if_match = _create_key("if-match");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
394 pb_key_if_modified_since = _create_key("if-modified-since");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
395 pb_key_if_none_match = _create_key("if-none-match");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
396 pb_key_if_range = _create_key("if-range");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
397 pb_key_if_unmodified_since = _create_key("if-unmodified-since");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
398 pb_key_ip = _create_key("ip");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
399 pb_key_iponly = _create_key("iponly");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
400 pb_key_issuer_dn = _create_key("issuer_dn");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
401 pb_key_jroute = _create_key("jroute");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
402 pb_key_keep_alive = _create_key("keep-alive");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
403 pb_key_keep_alive_timeout = _create_key("keep-alive-timeout");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
404 pb_key_keysize = _create_key("keysize");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
405 pb_key_lang = _create_key("lang");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
406 pb_key_last_modified = _create_key("last-modified");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
407 pb_key_level = _create_key("level");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
408 pb_key_location = _create_key("location");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
409 pb_key_lock_owner = _create_key("lock-owner");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
410 pb_key_magnus_charset = _create_key("magnus-charset");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
411 pb_key_magnus_internal = _create_key("magnus-internal");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
412 pb_key_magnus_internal_dav_src = _create_key("magnus-internal/dav-src");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
413 pb_key_magnus_internal_default_acls_only = _create_key("magnus-internal/default-acls-only");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
414 pb_key_magnus_internal_error_j2ee = _create_key("magnus-internal/error-j2ee");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
415 pb_key_magnus_internal_j2ee_nsapi = _create_key("magnus-internal/j2ee-nsapi");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
416 pb_key_magnus_internal_preserve_srvhdrs = _create_key("magnus-internal/preserve-srvhdrs-after-req-restart");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
417 pb_key_magnus_internal_set_request_status = _create_key("magnus-internal/set-request-status");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
418 pb_key_magnus_internal_set_response_status = _create_key("magnus-internal/set-response-status");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
419 pb_key_magnus_internal_webapp_errordesc = _create_key("magnus-internal/webapp-errordesc");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
420 pb_key_matched_browser = _create_key("matched-browser");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
421 pb_key_max_age = _create_key("max-age");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
422 pb_key_max_forwards = _create_key("max-forwards");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
423 pb_key_message = _create_key("message");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
424 pb_key_method = _create_key("method");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
425 pb_key_name = _create_key("name");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
426 pb_key_nocache = _create_key("nocache");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
427 pb_key_nostat = _create_key("nostat");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
428 pb_key_ntrans_base = _create_key("ntrans-base");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
429 pb_key_offline_origin_addr = _create_key("offline-origin-addr");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
430 pb_key_offline_proxy_addr = _create_key("offline-proxy-addr");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
431 pb_key_origin_addr = _create_key("origin-addr");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
432 pb_key_p2c_cl = _create_key("p2c-cl");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
433 pb_key_p2c_hl = _create_key("p2c-hl");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
434 pb_key_p2r_cl = _create_key("p2r-cl");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
435 pb_key_p2r_hl = _create_key("p2r-hl");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
436 pb_key_parse_timeout = _create_key("parse-timeout");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
437 pb_key_password = _create_key("password");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
438 pb_key_path = _create_key("path");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
439 pb_key_PATH_INFO = _create_key("PATH_INFO");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
440 pb_key_path_info = _create_key("path-info");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
441 pb_key_pblock = _create_key("pblock");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
442 pb_key_poll_interval = _create_key("poll-interval");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
443 pb_key_pool = _create_key("pool"); // new
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
444 pb_key_port = _create_key("port");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
445 pb_key_ppath = _create_key("ppath");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
446 pb_key_pragma = _create_key("pragma");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
447 pb_key_process_request_body = _create_key("process-request-body");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
448 pb_key_process_response_body = _create_key("process-response-body");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
449 pb_key_protocol = _create_key("protocol");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
450 pb_key_proxy_addr = _create_key("proxy-addr");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
451 pb_key_proxy_agent = _create_key("proxy-agent");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
452 pb_key_proxy_auth_cert = _create_key("proxy-auth-cert");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
453 pb_key_proxy_authorization = _create_key("proxy-authorization");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
454 pb_key_proxy_cipher = _create_key("proxy-cipher");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
455 pb_key_proxy_issuer_dn = _create_key("proxy-issuer-dn");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
456 pb_key_proxy_jroute = _create_key("proxy-jroute");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
457 pb_key_proxy_keysize = _create_key("proxy-keysize");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
458 pb_key_proxy_ping = _create_key("proxy-ping");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
459 pb_key_proxy_request = _create_key("proxy-request");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
460 pb_key_proxy_secret_keysize = _create_key("proxy-secret-keysize");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
461 pb_key_proxy_ssl_id = _create_key("proxy-ssl-id");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
462 pb_key_proxy_user_dn = _create_key("proxy-user-dn");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
463 pb_key_query = _create_key("query");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
464 pb_key_QUERY_STRING = _create_key("QUERY_STRING");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
465 pb_key_QUERY_STRING_UNESCAPED = _create_key("QUERY_STRING_UNESCAPED");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
466 pb_key_r2p_cl = _create_key("r2p-cl");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
467 pb_key_r2p_hl = _create_key("r2p-hl");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
468 pb_key_range = _create_key("range");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
469 pb_key_referer = _create_key("referer");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
470 pb_key_reformat_request_headers = _create_key("reformat-request-headers");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
471 pb_key_remote_status = _create_key("remote-status");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
472 pb_key_request_jroute = _create_key("request-jroute");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
473 pb_key_required_rights = _create_key("required-rights");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
474 pb_key_retries = _create_key("retries");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
475 pb_key_rewrite_content_location = _create_key("rewrite-content-location");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
476 pb_key_rewrite_host = _create_key("rewrite-host");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
477 pb_key_rewrite_location = _create_key("rewrite-location");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
478 pb_key_rewrite_set_cookie = _create_key("rewrite-set-cookie");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
479 pb_key_root = _create_key("root");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
480 pb_key_route = _create_key("route");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
481 pb_key_route_cookie = _create_key("route-cookie");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
482 pb_key_route_hdr = _create_key("route-hdr");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
483 pb_key_route_offline = _create_key("route-offline");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
484 pb_key_script_name = _create_key("script-name");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
485 pb_key_secret_keysize = _create_key("secret-keysize");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
486 pb_key_secure = _create_key("secure");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
487 pb_key_server = _create_key("server");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
488 pb_key_set_cookie = _create_key("set-cookie");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
489 pb_key_socks_addr = _create_key("socks_addr");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
490 pb_key_ssl_id = _create_key("ssl-id");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
491 pb_key_ssl_unclean_shutdown = _create_key("ssl-unclean-shutdown");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
492 pb_key_status = _create_key("status");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
493 pb_key_sticky_cookie = _create_key("sticky-cookie");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
494 pb_key_sticky_param = _create_key("sticky-param");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
495 pb_key_suppress_request_headers = _create_key("suppress-request-headers");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
496 pb_key_svr_status = _create_key("svr-status");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
497 pb_key_timeout = _create_key("timeout");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
498 pb_key_to = _create_key("to");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
499 pb_key_transfer_encoding = _create_key("transfer-encoding");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
500 pb_key_transmit_timeout = _create_key("transmit-timeout");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
501 pb_key_tunnel_non_http_response = _create_key("tunnel-non-http-response");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
502 pb_key_type = _create_key("type");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
503 pb_key_upstream_jroute = _create_key("upstream-jroute");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
504 pb_key_uri = _create_key("uri");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
505 pb_key_url = _create_key("url");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
506 pb_key_url_prefix = _create_key("url-prefix");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
507 pb_key_UseOutputStreamSize = _create_key("UseOutputStreamSize");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
508 pb_key_user = _create_key("user");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
509 pb_key_user_agent = _create_key("user-agent");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
510 pb_key_user_dn = _create_key("user_dn");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
511 pb_key_validate_server_cert = _create_key("validate-server-cert");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
512 pb_key_value = _create_key("value");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
513 pb_key_vary = _create_key("vary");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
514 pb_key_via = _create_key("via");
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
515 pb_key_warning = _create_key("warning");
386
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
516 pb_key_depth = _create_key("depth");
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
517 pb_key_if = _create_key("if");
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
518 pb_key_vfs = _create_key("vfs");
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
519 pb_key_dav = _create_key("dav");
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
520 pb_key_vfsclass = _create_key("vfsclass");
b91f8efadb63 merge cpp-ports
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 369 365
diff changeset
521 pb_key_davclass = _create_key("davclass");
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
522 }
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
523
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
524 NSAPI_PUBLIC void pblock_free_default_keys(void) {
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
525 for (unsigned i = 0 ; i < PB_KEY_LIST_BUCKET_COUNT ; i++) {
365
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
526 unsigned count = _pbKeys.buckets[i].size;
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
527 if (count > 0) {
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
528 pb_key **keys = _pbKeys.buckets[i].elements;
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
529 for (unsigned j = 0 ; j < count ; j++) {
556
b036ccad4b49 improve webserver shutdown and free some stuff to make the valgrind output cleaner
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 386
diff changeset
530 pb_key *key = keys[j];
b036ccad4b49 improve webserver shutdown and free some stuff to make the valgrind output cleaner
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 386
diff changeset
531 if(key) {
b036ccad4b49 improve webserver shutdown and free some stuff to make the valgrind output cleaner
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 386
diff changeset
532 free((char*)key->name);
b036ccad4b49 improve webserver shutdown and free some stuff to make the valgrind output cleaner
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 386
diff changeset
533 free(key);
b036ccad4b49 improve webserver shutdown and free some stuff to make the valgrind output cleaner
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 386
diff changeset
534 }
365
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
535 }
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
536 free(keys);
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
537 }
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
538 }
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
539 }
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
540
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
541 /* ------------------------------ _find_key ------------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
542
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
543 static inline const pb_key *_find_key(const char *name, unsigned int hashval)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
544 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
545 /* Check to see if name corresponds to a pb_key */
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
546 struct pb_key_list_bucket *bucket = &_pbKeys.buckets[hashval & PB_KEY_LIST_BUCKET_COUNT];
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
547 for (unsigned i = 0 ; i < bucket->size ; i++) {
365
2ea1ed291e9f revert optimization that does not harmonize with realloc()
Mike Becker <universe@uap-core.de>
parents: 363
diff changeset
548 pb_key *key = bucket->elements[i];
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
549 if (key->hashval == hashval && !strcmp(key->name, name)) {
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
550 return key;
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
551 }
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
552 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
553 return NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
554 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
555
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
556
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
557 /* --------------------------- _get_hash_index ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
558
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
559 static inline int _get_hash_index(const PListStruct_t *pl, const pb_key *key)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
560 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
561 /* Get the hash index from the key. Requires a symbol table. */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
562 int i;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
563 if (key->sizendx == pl->pl_symtab->pt_sizendx)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
564 i = key->hashndx;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
565 else
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
566 i = key->hashval % PLSIZENDX(pl->pl_symtab->pt_sizendx);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
567 return i;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
568 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
569
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
570
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
571 /* ---------------------------- _param_create ----------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
572
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
573 static inline pb_param *_param_create(pool_handle_t *pool_handle, const char *name, int namelen, const char *value, int valuelen)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
574 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
575 PLValueStruct_t *ret;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
576
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
577 ret = (PLValueStruct_t *)pool_malloc(pool_handle, sizeof(PLValueStruct_t));
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
578
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
579 ret->pv_pbentry.param = &ret->pv_pbparam;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
580 ret->pv_pbentry.next = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
581 ret->pv_next = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
582 ret->pv_type = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
583 ret->pv_mempool = pool_handle;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
584
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
585 if (name || namelen) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
586 ret->pv_name = (char*)pool_malloc(pool_handle, namelen + 1);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
587 if (name) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
588 memcpy(ret->pv_name, name, namelen);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
589 ret->pv_name[namelen] = '\0';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
590 } else {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
591 ret->pv_name[0] = '\0';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
592 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
593 } else {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
594 ret->pv_name = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
595 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
596
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
597 if (value || valuelen) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
598 ret->pv_value = (char*)pool_malloc(pool_handle, valuelen + 1);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
599 if (value) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
600 memcpy(ret->pv_value, value, valuelen);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
601 ret->pv_value[valuelen] = '\0';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
602 } else {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
603 ret->pv_value[0] = '\0';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
604 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
605 } else {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
606 ret->pv_value = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
607 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
608
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
609 return &ret->pv_pbparam;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
610 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
611
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
612
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
613 /* ----------------------- pblock_key_param_create ----------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
614
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
615 NSAPI_PUBLIC pb_param *pblock_key_param_create(pblock *pb, const pb_key *key, const char *value, int valuelen)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
616 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
617 /*
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
618 * Allocate a PLValueStruct_t from the property list's memory pool.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
619 */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
620 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
621 return _param_create(pl->pl_mempool, key->name, key->namelen, value, valuelen);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
622 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
623
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
624
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
625 /* ------------------------- pblock_param_create -------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
626
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
627 NSAPI_PUBLIC pb_param *pblock_param_create(pblock *pb, const char *name, const char *value)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
628 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
629 /*
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
630 * Allocate a PLValueStruct_t from the property list's memory pool.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
631 */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
632 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
633 return _param_create(pl->pl_mempool, name, name ? strlen(name) : 0, value, value ? strlen(value) : 0);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
634 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
635
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
636
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
637 /* ----------------------------- param_create ----------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
638
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
639 NSAPI_PUBLIC pb_param *param_create(const char *name, const char *value)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
640 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
641 /*
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
642 * Allocate a PLValueStruct_t containing the pb_param that will
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
643 * be returned. Normally PLValueStruct_ts are allocated from the
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
644 * memory pool associated with a property list, but we don't have
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
645 * that here, so we just use the thread's pool and indicate we were
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
646 * allocated from a specific pool.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
647 */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
648 return _param_create(system_pool(), name, name ? strlen(name) : 0, value, value ? strlen(value) : 0);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
649 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
650
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
651
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
652 /* ------------------------------ param_free ------------------------------ */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
653
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
654 NSAPI_PUBLIC int param_free(pb_param *pp)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
655 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
656 if (pp) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
657 PLValueStruct_t *pv = PATOPV(pp);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
658
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
659 /* Don't bother if the pblock was allocated from a pool */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
660 if (!pv->pv_mempool) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
661 pool_free(pv->pv_mempool, pv->pv_name);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
662 pool_free(pv->pv_mempool, pv->pv_value);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
663 pool_free(pv->pv_mempool, pv);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
664 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
665
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
666 return 1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
667 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
668
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
669 return 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
670 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
671
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
672
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
673 /* -------------------------- pblock_create_pool -------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
674
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
675 NSAPI_PUBLIC pblock *pblock_create_pool(pool_handle_t *pool_handle, int n)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
676 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
677 /* Create a property list with n property indices */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
678 PListStruct_t *plist = (PListStruct_t *)PListCreate(pool_handle, n, 0, 0);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
679 if (!plist)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
680 return NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
681
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
682 plist->pl_resvpi = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
683
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
684 return &plist->pl_pb;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
685 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
686
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
687
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
688 /* ----------------------------- pblock_pool ------------------------------ */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
689
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
690 NSAPI_PUBLIC pool_handle_t *pblock_pool(pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
691 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
692 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
693 return pl->pl_mempool;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
694 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
695
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
696
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
697 /* ---------------------------- pblock_create ----------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
698
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
699 NSAPI_PUBLIC pblock *pblock_create(int n)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
700 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
701 return pblock_create_pool(MALLOC_POOL_HANDLE, n);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
702 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
703
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
704
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
705 /* ----------------------------- pblock_free ------------------------------ */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
706
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
707 NSAPI_PUBLIC void pblock_free(pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
708 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
709 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
710 PLValueStruct_t **ppval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
711 PLValueStruct_t *pv;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
712 int i;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
713
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
714 if (!pb) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
715 return;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
716 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
717
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
718 /* If the pools are enabled, this routine has no effect anyway, so
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
719 * just return.
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
720 */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
721 if (pl->pl_mempool || pool_enabled()) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
722 return;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
723 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
724
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
725 /* Free the property name symbol table if any */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
726 if (pl->pl_symtab) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
727 pool_free(pl->pl_mempool, (void *)(pl->pl_symtab));
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
728 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
729
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
730 ppval = (PLValueStruct_t **)(pl->pl_ppval);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
731
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
732 /* Loop over the initialized property indices */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
733 for (i = 0; i < pl->pl_initpi; ++i) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
734
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
735 /* Got a property here? */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
736 pv = ppval[i];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
737 if (pv) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
738
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
739 param_free(&pv->pv_pbparam);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
740 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
741 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
742
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
743 /* Free the array of pointers to property values */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
744 pool_free(pl->pl_mempool, (void *)ppval);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
745
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
746 /* Free the property list head */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
747 pool_free(pl->pl_mempool, (void *)pl);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
748 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
749
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
750
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
751 /* ------------------------------ pblock_key ------------------------------ */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
752
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
753 NSAPI_PUBLIC const pb_key *pblock_key(const char *name)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
754 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
755 if (!name)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
756 return NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
757
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
758 return _find_key(name, PListHash(name));
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
759 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
760
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
761
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
762 /* --------------------------- pblock_kpinsert ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
763
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
764 NSAPI_PUBLIC void pblock_kpinsert(const pb_key *key, pb_param *pp, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
765 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
766 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
767 PLValueStruct_t *pv = PATOPV(pp);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
768
24
1a7853a4257e removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 14
diff changeset
769 //PR_ASSERT(pv->pv_mempool == pl->pl_mempool); // TODO
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
770
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
771 /* Check to see if the name corresponds to a pb_key */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
772 unsigned int hashval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
773 if (!key) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
774 hashval = PListHash(pv->pv_name);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
775 key = _find_key(pv->pv_name, hashval);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
776 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
777
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
778 /* Find property index */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
779 int pindex = PListGetFreeIndex(pl);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
780 if (pindex < 1) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
781 /* Error - invalid property index */
3
137197831306 minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
782 printf("Error - invalid property index\n");
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
783 return;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
784 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
785
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
786 /* Allocate/grow the symbol table as needed */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
787 PLSymbolTable_t *pt = PListSymbolTable(pl);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
788 if (!pt) {
3
137197831306 minimal request handling
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 1
diff changeset
789 printf("!pt\n");
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
790 return;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
791 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
792
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
793 /* Add PLValueStruct_t to the property list */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
794 PLValueStruct_t **ppval = (PLValueStruct_t **)(pl->pl_ppval);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
795 pv->pv_pbkey = key;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
796 pv->pv_pi = pindex;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
797 ppval[pv->pv_pi - 1] = pv;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
798
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
799 /* Add name to symbol table */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
800 int i = key ? _get_hash_index(pl, key) : (hashval % PLSIZENDX(pt->pt_sizendx));
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
801 pv->pv_next = pt->pt_hash[i];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
802 pt->pt_hash[i] = pv;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
803 pt->pt_nsyms++;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
804
24
1a7853a4257e removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 14
diff changeset
805 //PR_ASSERT(param_key(pp) == key); // TODO
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
806 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
807
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
808
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
809 /* ---------------------------- pblock_pinsert ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
810
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
811 NSAPI_PUBLIC void pblock_pinsert(pb_param *pp, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
812 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
813 pblock_kpinsert(NULL, pp, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
814 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
815
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
816
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
817 /* --------------------------- pblock_nvinsert ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
818
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
819 NSAPI_PUBLIC pb_param *pblock_nvinsert(const char *name, const char *value, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
820 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
821 pb_param *pp = pblock_param_create(pb, name, value);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
822 if (pp)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
823 pblock_kpinsert(NULL, pp, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
824 return pp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
825 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
826
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
827
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
828 /* --------------------------- pblock_kvinsert ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
829
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
830 NSAPI_PUBLIC pb_param *pblock_kvinsert(const pb_key *key, const char *value, int valuelen, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
831 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
832 pb_param *pp = pblock_key_param_create(pb, key, value, valuelen);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
833 if (pp)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
834 pblock_kpinsert(key, pp, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
835 return pp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
836 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
837
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
838
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
839 /* --------------------------- pblock_nninsert ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
840
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
841 NSAPI_PUBLIC pb_param *pblock_nninsert(const char *name, int value, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
842 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
843 char num[UTIL_ITOA_SIZE];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
844
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
845 util_itoa(value, num);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
846 return pblock_nvinsert(name, num, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
847 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
848
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
849
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
850 /* --------------------------- pblock_kninsert ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
851
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
852 NSAPI_PUBLIC pb_param *pblock_kninsert(const pb_key *key, int value, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
853 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
854 pb_param *pp = pblock_key_param_create(pb, key, NULL, UTIL_ITOA_SIZE);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
855 if (pp) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
856 util_itoa(value, pp->value);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
857 pblock_kpinsert(key, pp, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
858 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
859 return pp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
860 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
861
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
862
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
863 /* --------------------------- pblock_kllinsert --------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
864
24
1a7853a4257e removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 14
diff changeset
865 NSAPI_PUBLIC pb_param *pblock_kllinsert(const pb_key *key, int64_t value, pblock *pb)
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
866 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
867 pb_param *pp = pblock_key_param_create(pb, key, NULL, UTIL_I64TOA_SIZE);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
868 if (pp) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
869 util_i64toa(value, pp->value);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
870 pblock_kpinsert(key, pp, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
871 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
872 return pp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
873 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
874
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
875
5
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
876 /* ---------------------------pblock_nvlinsert ---------------------------- */
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
877
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
878 NSAPI_PUBLIC pb_param *pblock_nvlinsert(const char *name, int namelen, const char *value, int valuelen, pblock *pb)
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
879 {
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
880 PListStruct_t *pl = PBTOPL(pb);
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
881
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
882 pb_param *pp = _param_create(pl->pl_mempool, name, namelen, value, valuelen);
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
883
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
884 if(pp) {
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
885 pblock_kpinsert(NULL, pp, pb);
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
886 }
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
887
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
888 return pp;
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
889 }
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
890
dbc01588686e Added parser for obj.conf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 3
diff changeset
891
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
892 /* ---------------------------- pblock_findkey ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
893
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
894 NSAPI_PUBLIC pb_param *pblock_findkey(const pb_key *key, const pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
895 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
896 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
897
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
898 /* Lookup key by examining symbol table */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
899 if (pl->pl_symtab) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
900 int i = _get_hash_index(pl, key);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
901 PLValueStruct_t *pv;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
902
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
903 /* Search hash collision list for matching name */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
904 for (pv = pl->pl_symtab->pt_hash[i]; pv; pv = pv->pv_next) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
905 if (pv->pv_pbkey == key)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
906 return &pv->pv_pbparam;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
907 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
908 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
909
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
910 return NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
911 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
912
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
913
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
914 /* -------------------------- pblock_findkeyval --------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
915
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
916 NSAPI_PUBLIC char *pblock_findkeyval(const pb_key *key, const pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
917 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
918 pb_param *pp = pblock_findkey(key, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
919 return pp ? pp->value : NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
920 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
921
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
922
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
923 /* ---------------------------- pblock_findval ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
924
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
925 NSAPI_PUBLIC char *pblock_findval(const char *name, const pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
926 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
927 void *pvalue = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
928
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
929 (void)PListFindValue((PList_t)(PBTOPL(pb)), name, &pvalue, 0);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
930
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
931 return (char *)pvalue;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
932 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
933
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
934
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
935 /* ------------------------------ pblock_fr ------------------------------ */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
936
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
937 NSAPI_PUBLIC pb_param *pblock_fr(const char *name, pblock *pb, int remove)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
938 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
939 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
940 PLValueStruct_t **ppval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
941 PLValueStruct_t **pvp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
942 PLValueStruct_t *pv = NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
943 int pindex;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
944 int i;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
945
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
946 if (pl->pl_symtab) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
947
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
948 /* Compute hash index of specified property name */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
949 i = PListHashName(pl->pl_symtab, name);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
950
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
951 /* Search hash collision list for matching name */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
952 for (pvp = &pl->pl_symtab->pt_hash[i];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
953 (pv = *pvp); pvp = &(*pvp)->pv_next) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
954
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
955 if (!strcmp(name, pv->pv_name)) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
956
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
957 if (remove) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
958 /* Remove PLValueStruct_t from symbol table */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
959 *pvp = pv->pv_next;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
960 pl->pl_symtab->pt_nsyms--;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
961
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
962 /* Remove it from pl_ppval too */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
963 ppval = (PLValueStruct_t **)(pl->pl_ppval);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
964 pindex = pv->pv_pi;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
965 ppval[pindex - 1] = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
966 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
967 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
968 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
969 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
970 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
971
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
972 return (pv) ? &pv->pv_pbparam : NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
973 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
974
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
975
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
976 /* --------------------------- pblock_removekey --------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
977
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
978 NSAPI_PUBLIC pb_param *pblock_removekey(const pb_key *key, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
979 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
980 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
981 PLValueStruct_t **ppval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
982 PLValueStruct_t **pvp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
983 PLValueStruct_t *pv = NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
984 int pindex;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
985 int i;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
986
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
987 if (pl->pl_symtab) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
988 /* Lookup hash index for specified property key */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
989 i = _get_hash_index(pl, key);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
990
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
991 /* Search hash collision list for matching key */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
992 for (pvp = &pl->pl_symtab->pt_hash[i]; (pv = *pvp); pvp = &pv->pv_next) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
993 /* If this value has the requested key... */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
994 if (pv->pv_pbkey == key) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
995 /* Remove PLValueStruct_t from symbol table */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
996 *pvp = pv->pv_next;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
997 pl->pl_symtab->pt_nsyms--;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
998
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
999 /* Remove it from pl_ppval too */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1000 ppval = (PLValueStruct_t **)(pl->pl_ppval);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1001 pindex = pv->pv_pi;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1002 ppval[pindex - 1] = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1003
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1004 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1005 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1006 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1007 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1008
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1009 return (pv) ? &pv->pv_pbparam : NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1010 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1011
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1012
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1013 /* -------------------------- pblock_removeone --------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1014
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1015 NSAPI_PUBLIC pb_param *pblock_removeone(pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1016 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1017 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1018
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1019 if (pl && pl->pl_symtab) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1020 /* Search hash buckets */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1021 for (int i = 0; i < PLSIZENDX(pl->pl_symtab->pt_sizendx); i++) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1022 /* Search hash collision list */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1023 PLValueStruct_t *pv = pl->pl_symtab->pt_hash[i];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1024 if (pv) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1025 /* Remove PLValueStruct_t from symbol table */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1026 pl->pl_symtab->pt_hash[i] = pv->pv_next;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1027 pl->pl_symtab->pt_nsyms--;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1028
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1029 /* Remove it from pl_ppval too */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1030 PLValueStruct_t **ppval = (PLValueStruct_t**)pl->pl_ppval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1031 ppval[pv->pv_pi - 1] = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1032
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1033 return &pv->pv_pbparam;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1034 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1035 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1036 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1037
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1038 return NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1039 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1040
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1041
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1042 /* -------------------------- pblock_str2pblock --------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1043
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1044
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1045 int _verify_pbstr(const char *str)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1046 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1047 const char *cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1048 const char *scp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1049 int np;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1050 int state;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1051 int quote;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1052
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1053 for(cp = str, np = 0, state = 0; *cp; ) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1054 switch (state) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1055 case 0: /* skipping leading spaces */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1056
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1057 while (*cp && isspace(*cp)) ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1058 if (*cp == '=') {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1059 return -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1060 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1061 if (*cp) state = 1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1062 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1063
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1064 case 1: /* scanning parameter name */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1065
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1066 scp = cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1067 while (*cp && (*cp != '=') && !isspace(*cp)) ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1068 if (*cp == '=') ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1069 else cp = scp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1070 state = 2;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1071 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1072
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1073 case 2: /* scanning parameter value */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1074 quote = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1075 if (*cp == '\"') {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1076 quote = 1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1077 ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1078 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1079 for (;;) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1080 if (*cp == '\\') {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1081 ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1082 if (*cp == 0) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1083 return -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1084 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1085 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1086 else if (*cp == '\"') {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1087 if (!quote) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1088 return -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1089 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1090 ++np;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1091 ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1092 quote = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1093 state = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1094 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1095 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1096 else if (!quote && (!*cp || isspace(*cp))) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1097 ++np;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1098 if (*cp) ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1099 state = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1100 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1101 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1102 else if (*cp == 0) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1103 return -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1104 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1105 ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1106 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1107 if (quote) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1108 return -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1109 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1110 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1111 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1112 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1113
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1114 return (state == 0) ? np : -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1115 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1116
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1117 NSAPI_PUBLIC int
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1118 INTpblock_str2pblock_lowercasename(const char *str, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1119 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1120 return _pblock_str2pblock(str, pb, PR_TRUE);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1121 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1122
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1123 NSAPI_PUBLIC int pblock_str2pblock(const char *str, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1124 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1125 return _pblock_str2pblock(str, pb, PR_FALSE);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1126 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1127
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1128 int
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1129 _pblock_str2pblock(const char* str, pblock* pb, PRBool lowerCase)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1130 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1131 char *cpy;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1132 char *cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1133 char *dp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1134 char *pname;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1135 char *pvalue;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1136 int np;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1137 int quote;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1138 int state;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1139 char numbuf[UTIL_ITOA_SIZE];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1140
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1141 if((np = _verify_pbstr(str)) < 1)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1142 return -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1143
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1144 while (*str && isspace(*str)) ++str;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1145
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1146 cpy = STRDUP(str);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1147
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1148 for (np = 0, cp = cpy, state = 0; *cp; ) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1149 switch (state) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1150
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1151 case 0: /* skipping leading spaces */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1152
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1153 while (*cp && isspace(*cp)) ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1154 if (*cp) state = 1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1155 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1156
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1157 case 1: /* scanning parameter name */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1158
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1159 pname = cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1160 while (*cp && (*cp != '=') && !isspace(*cp)) ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1161 if (*cp == '=') {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1162 *cp++ = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1163 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1164 else {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1165 cp = pname;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1166 pname = numbuf;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1167 util_itoa(np+1, numbuf);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1168 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1169 state = 2;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1170 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1171
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1172 case 2: /* scanning parameter value */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1173 quote = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1174 if (*cp == '\"') {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1175 quote = 1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1176 ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1177 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1178 for (pvalue = cp, dp = cp; ; ++cp, ++dp) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1179 if (*cp == '\\') {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1180 ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1181 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1182 else if (*cp == '\"') {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1183 ++np;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1184 ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1185 *dp = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1186 quote = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1187 state = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1188 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1189 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1190 else if (!quote && ((*cp == 0) || isspace(*cp))) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1191 ++np;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1192 if (*cp != 0) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1193 ++cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1194 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1195 *dp = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1196 state = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1197 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1198 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1199 if (cp != dp) *dp = *cp;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1200 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1201 if (lowerCase == PR_TRUE) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1202 for (char* p = pname; *p; p++) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1203 *p = tolower(*p);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1204 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1205 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1206 pblock_nvinsert(pname, pvalue, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1207 break;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1208 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1209 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1210
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1211 FREE(cpy);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1212
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1213 return np;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1214 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1215
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1216
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1217 /* -------------------------- pblock_pblock2str --------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1218
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1219
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1220 NSAPI_PUBLIC char *pblock_pblock2str(const pblock *pb, char *str)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1221 {
363
7f0f5c03666a port pblock.cpp to pblock.c
Mike Becker <universe@uap-core.de>
parents: 77
diff changeset
1222 char *s = str, *t, *u;
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1223 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1224 PLValueStruct_t **ppval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1225 PLValueStruct_t *pv;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1226 int i;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1227 int sl;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1228 int xlen;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1229
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1230 ppval = (PLValueStruct_t **)(pl->pl_ppval);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1231
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1232 /* Loop over the initialized property indices */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1233 for (i = 0, xlen = 0; i < pl->pl_initpi; ++i) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1234
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1235 /* Got a property here? */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1236 pv = ppval[i];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1237 if (pv && pv->pv_name) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1238
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1239 int ln = strlen(pv->pv_name);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1240 int lv = strlen((char *)(pv->pv_value));
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1241
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1242 /* Check for " or \ because we'll have to escape them */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1243 for (t = (char *)(pv->pv_value); *t; ++t) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1244 if ((*t == '\"') || (*t == '\\')) ++lv;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1245 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1246
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1247 /* 4: two quotes, =, and a null */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1248 xlen += (ln + lv + 4);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1249 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1250 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1251
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1252 /* Allocate string to hold parameter settings, or increase size */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1253 if (!s) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1254 s = (char *)MALLOC(xlen);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1255 s[0] = '\0';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1256 t = &s[0];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1257 sl = xlen;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1258 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1259 else {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1260 sl = strlen(s);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1261 t = &s[sl];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1262 sl += xlen;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1263 s = (char *)REALLOC(s, sl);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1264 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1265
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1266 /* Loop over the initialized property indices */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1267 for (i = 0; i < pl->pl_initpi; ++i) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1268
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1269 /* Got a property here? */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1270 pv = ppval[i];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1271 if (pv && pv->pv_name) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1272
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1273 if (t != s) *t++ = ' ';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1274
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1275 for (u = pv->pv_name; *u; ) *t++ = *u++;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1276
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1277 *t++ = '=';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1278 *t++ = '\"';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1279
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1280 for (u = (char *)(pv->pv_value); *u; ) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1281 if ((*u == '\\') || (*u == '\"')) *t++ = '\\';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1282 *t++ = *u++;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1283 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1284
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1285 *t++ = '\"';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1286 *t = '\0';
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1287 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1288 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1289
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1290 return s;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1291 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1292
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1293
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1294 /* ----------------------------- pblock_copy ------------------------------ */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1295
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1296
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1297 NSAPI_PUBLIC int pblock_copy(const pblock *src, pblock *dst)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1298 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1299 PListStruct_t *pl = PBTOPL(src);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1300 PLValueStruct_t **ppval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1301 PLValueStruct_t *pv;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1302 int rv = 0;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1303 int i;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1304
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1305 ppval = (PLValueStruct_t **)(pl->pl_ppval);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1306
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1307 for (i = 0; i < pl->pl_initpi; ++i) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1308 pv = ppval[i];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1309 if (pv) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1310 if (pv->pv_pbkey) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1311 if (pv->pv_pbkey != pb_key_magnus_internal) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1312 if (!pblock_kvinsert(pv->pv_pbkey, (char *)(pv->pv_value), strlen(pv->pv_value), dst))
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1313 rv = -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1314 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1315 } else {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1316 if (!pblock_nvinsert(pv->pv_name, (char *)(pv->pv_value), dst))
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1317 rv = -1;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1318 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1319 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1320 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1321
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1322 return rv;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1323 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1324
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1325 /* ---------------------------- pblock_dup -------------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1326
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1327 NSAPI_PUBLIC pblock *pblock_dup(const pblock *src)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1328 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1329 pblock *dst;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1330
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1331 if (!src)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1332 return NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1333
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1334 if ( (dst = pblock_create(src->hsize)) )
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1335 pblock_copy(src, dst);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1336
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1337 return dst;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1338 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1339
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1340
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1341 /* ---------------------------- pblock_pb2env ----------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1342
71
069c152f6272 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
1343
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1344 NSAPI_PUBLIC char **pblock_pb2env(const pblock *pb, char **env)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1345 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1346 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1347 PLValueStruct_t **ppval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1348 PLValueStruct_t *pv;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1349 int i;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1350 int nval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1351 int pos;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1352
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1353 /* Find out how many there are. */
71
069c152f6272 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
1354
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1355 ppval = (PLValueStruct_t **)(pl->pl_ppval);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1356
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1357 for (i = 0, nval = 0; i < pl->pl_initpi; ++i) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1358 if (ppval[i]) ++nval;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1359 }
71
069c152f6272 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
1360
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1361 env = util_env_create(env, nval, &pos);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1362
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1363 for (i = 0; i < pl->pl_initpi; ++i) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1364 pv = ppval[i];
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1365 if (pv) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1366 env[pos++] = util_env_str(pv->pv_name, (char *)(pv->pv_value));
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1367 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1368 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1369 env[pos] = NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1370
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1371 return env;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1372 }
71
069c152f6272 ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 37
diff changeset
1373
1
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1374
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1375 /* ---------------------------- pblock_replace ---------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1376
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1377 NSAPI_PUBLIC char * pblock_replace(const char *name,
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1378 char * new_value, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1379 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1380 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1381
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1382 /* Replace an existing value */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1383 pb_param *pp = pblock_find(name, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1384 if (!pp)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1385 return NULL;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1386 pool_free(pl->pl_mempool, pp->value);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1387 pp->value = new_value;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1388
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1389 return new_value;
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1390 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1391
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1392
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1393 /* --------------------------- pblock_nvreplace --------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1394
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1395 NSAPI_PUBLIC void pblock_nvreplace (const char *name, const char *value, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1396 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1397 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1398
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1399 /* Replace an existing value or insert a new value */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1400 pb_param *pp = pblock_find(name, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1401 if (pp) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1402 pool_free(pl->pl_mempool, pp->value);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1403 pp->value = pool_strdup(pl->pl_mempool, value);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1404 } else {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1405 pblock_nvinsert(name, value, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1406 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1407 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1408
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1409
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1410 /* --------------------------- pblock_kvreplace --------------------------- */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1411
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1412 NSAPI_PUBLIC void pblock_kvreplace(const pb_key *key, const char *value, int valuelen, pblock *pb)
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1413 {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1414 PListStruct_t *pl = PBTOPL(pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1415
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1416 /* Replace an existing value or insert a new value */
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1417 pb_param *pp = pblock_findkey(key, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1418 if (pp) {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1419 pool_free(pl->pl_mempool, pp->value);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1420 pp->value = (char*)pool_malloc(pl->pl_mempool, valuelen + 1);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1421 memcpy(pp->value, value, valuelen + 1);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1422 } else {
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1423 pblock_kvinsert(key, value, valuelen, pb);
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1424 }
3c066d52342d added source
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1425 }

mercurial