src/server/util/pblock.cpp

changeset 71
069c152f6272
parent 37
360b9aabe17e
child 77
f1cff81e425a
equal deleted inserted replaced
70:4e6e812c1d97 71:069c152f6272
331 static inline const pb_key *_find_key(const char *name, unsigned int hashval) 331 static inline const pb_key *_find_key(const char *name, unsigned int hashval)
332 { 332 {
333 /* Check to see if name corresponds to a pb_key */ 333 /* Check to see if name corresponds to a pb_key */
334 CListConstIterator<pb_key> iter(&_hashKeys.Find(hashval)); 334 CListConstIterator<pb_key> iter(&_hashKeys.Find(hashval));
335 const pb_key *key; 335 const pb_key *key;
336 while (key = ++iter) { 336 while((key = ++iter)) {
337 if (key->hashval == hashval && !strcmp(key->name, name)) 337 if (key->hashval == hashval && !strcmp(key->name, name))
338 return key; 338 return key;
339 } 339 }
340 return NULL; 340 return NULL;
341 } 341 }
1125 } 1125 }
1126 1126
1127 1127
1128 /* ---------------------------- pblock_pb2env ----------------------------- */ 1128 /* ---------------------------- pblock_pb2env ----------------------------- */
1129 1129
1130 /* 1130
1131 NSAPI_PUBLIC char **pblock_pb2env(const pblock *pb, char **env) 1131 NSAPI_PUBLIC char **pblock_pb2env(const pblock *pb, char **env)
1132 { 1132 {
1133 PListStruct_t *pl = PBTOPL(pb); 1133 PListStruct_t *pl = PBTOPL(pb);
1134 PLValueStruct_t **ppval; 1134 PLValueStruct_t **ppval;
1135 PLValueStruct_t *pv; 1135 PLValueStruct_t *pv;
1136 int i; 1136 int i;
1137 int nval; 1137 int nval;
1138 int pos; 1138 int pos;
1139 1139
1140 /* Find out how many there are. */ 1140 /* Find out how many there are. */
1141 /* 1141
1142 ppval = (PLValueStruct_t **)(pl->pl_ppval); 1142 ppval = (PLValueStruct_t **)(pl->pl_ppval);
1143 1143
1144 for (i = 0, nval = 0; i < pl->pl_initpi; ++i) { 1144 for (i = 0, nval = 0; i < pl->pl_initpi; ++i) {
1145 if (ppval[i]) ++nval; 1145 if (ppval[i]) ++nval;
1146 } 1146 }
1147 1147
1148 // TODO: implement util_env_create and util_env_str
1149 /*
1148 env = util_env_create(env, nval, &pos); 1150 env = util_env_create(env, nval, &pos);
1149 1151
1150 for (i = 0; i < pl->pl_initpi; ++i) { 1152 for (i = 0; i < pl->pl_initpi; ++i) {
1151 pv = ppval[i]; 1153 pv = ppval[i];
1152 if (pv) { 1154 if (pv) {
1153 env[pos++] = util_env_str(pv->pv_name, (char *)(pv->pv_value)); 1155 env[pos++] = util_env_str(pv->pv_name, (char *)(pv->pv_value));
1154 } 1156 }
1155 } 1157 }
1156 env[pos] = NULL; 1158 env[pos] = NULL;
1159 */
1157 1160
1158 return env; 1161 return env;
1159 } 1162 }
1160 */ 1163
1161 1164
1162 /* ---------------------------- pblock_replace ---------------------------- */ 1165 /* ---------------------------- pblock_replace ---------------------------- */
1163 1166
1164 NSAPI_PUBLIC char * pblock_replace(const char *name, 1167 NSAPI_PUBLIC char * pblock_replace(const char *name,
1165 char * new_value, pblock *pb) 1168 char * new_value, pblock *pb)

mercurial