Lines Matching defs:top
2362 ucl_object_insert_key_common (ucl_object_t *top, ucl_object_t *elt,
2375 if (top == NULL) {
2379 if (top->type != UCL_OBJECT) {
2381 if (top->type == UCL_NULL) {
2382 top->type = UCL_OBJECT;
2390 if (top->value.ov == NULL) {
2391 top->value.ov = ucl_hash_create (false);
2421 found = __DECONST (ucl_object_t *, ucl_hash_search_obj (top->value.ov, elt));
2424 top->value.ov = ucl_hash_insert_object (top->value.ov, elt, false);
2425 top->len ++;
2432 ucl_hash_replace (top->value.ov, found, elt);
2440 ucl_hash_delete (top->value.ov, found);
2441 top->value.ov = ucl_hash_insert_object (top->value.ov, elt, false);
2471 ucl_object_delete_keyl (ucl_object_t *top, const char *key, size_t keylen)
2475 if (top == NULL || key == NULL) {
2479 found = __DECONST (ucl_object_t *, ucl_object_lookup_len (top, key, keylen));
2485 ucl_hash_delete (top->value.ov, found);
2487 top->len --;
2493 ucl_object_delete_key (ucl_object_t *top, const char *key)
2495 return ucl_object_delete_keyl (top, key, strlen (key));
2499 ucl_object_pop_keyl (ucl_object_t *top, const char *key, size_t keylen)
2503 if (top == NULL || key == NULL) {
2506 found = ucl_object_lookup_len (top, key, keylen);
2511 ucl_hash_delete (top->value.ov, found);
2512 top->len --;
2518 ucl_object_pop_key (ucl_object_t *top, const char *key)
2520 return ucl_object_pop_keyl (top, key, strlen (key));
2524 ucl_object_insert_key (ucl_object_t *top, ucl_object_t *elt,
2527 return ucl_object_insert_key_common (top, elt, key, keylen, copy_key, false, false);
2531 ucl_object_insert_key_merged (ucl_object_t *top, ucl_object_t *elt,
2534 return ucl_object_insert_key_common (top, elt, key, keylen, copy_key, true, false);
2538 ucl_object_replace_key (ucl_object_t *top, ucl_object_t *elt,
2541 return ucl_object_insert_key_common (top, elt, key, keylen, copy_key, false, true);
2545 ucl_object_merge (ucl_object_t *top, ucl_object_t *elt, bool copy)
2550 if (top == NULL || elt == NULL) {
2554 if (top->type == UCL_ARRAY) {
2557 return ucl_array_merge (top, elt, copy);
2561 ucl_array_append (top, ucl_object_copy (elt));
2566 ucl_array_append (top, ucl_object_ref (elt));
2572 else if (top->type == UCL_OBJECT) {
2585 ucl_hash_search (top->value.ov, cp->key, cp->keylen));
2589 top->value.ov = ucl_hash_insert_object (top->value.ov, cp,
2591 top->len++;
2601 ucl_hash_replace (top->value.ov, found, cp);
2616 ucl_hash_search (top->value.ov, cp->key, cp->keylen));
2620 top->value.ov = ucl_hash_insert_object (top->value.ov, cp,
2622 top->len++;
2632 ucl_hash_replace (top->value.ov, found, cp);
2912 ucl_object_lookup_path (const ucl_object_t *top, const char *path_in) {
2913 return ucl_object_lookup_path_char (top, path_in, '.');
2918 ucl_object_lookup_path_char (const ucl_object_t *top, const char *path_in, const char sep) {
2924 if (path_in == NULL || top == NULL) {
2941 switch (top->type) {
2948 o = ucl_array_find_index (top, index);
2951 o = ucl_object_lookup_len (top, c, p - c);
2957 top = o;
3123 ucl_array_append (ucl_object_t *top, ucl_object_t *elt)
3125 UCL_ARRAY_GET (vec, top);
3127 if (elt == NULL || top == NULL) {
3139 top->value.av = (void *)vec;
3144 top->len ++;
3152 ucl_array_prepend (ucl_object_t *top, ucl_object_t *elt)
3154 UCL_ARRAY_GET (vec, top);
3156 if (elt == NULL || top == NULL) {
3163 top->value.av = (void *)vec;
3171 top->len ++;
3179 ucl_array_merge (ucl_object_t *top, ucl_object_t *elt, bool copy)
3185 if (elt == NULL || top == NULL || top->type != UCL_ARRAY || elt->type != UCL_ARRAY) {
3196 UCL_ARRAY_GET (v1, top);
3207 top->len ++;
3217 ucl_array_delete (ucl_object_t *top, ucl_object_t *elt)
3219 UCL_ARRAY_GET (vec, top);
3231 top->len --;
3240 ucl_array_head (const ucl_object_t *top)
3242 UCL_ARRAY_GET (vec, top);
3244 if (vec == NULL || top == NULL || top->type != UCL_ARRAY ||
3245 top->value.av == NULL) {
3253 ucl_array_tail (const ucl_object_t *top)
3255 UCL_ARRAY_GET (vec, top);
3257 if (top == NULL || top->type != UCL_ARRAY || top->value.av == NULL) {
3265 ucl_array_pop_last (ucl_object_t *top)
3267 UCL_ARRAY_GET (vec, top);
3274 top->len --;
3281 ucl_array_pop_first (ucl_object_t *top)
3283 UCL_ARRAY_GET (vec, top);
3290 top->len --;
3297 ucl_array_size (const ucl_object_t *top)
3299 if (top == NULL || top->type != UCL_ARRAY) {
3303 UCL_ARRAY_GET (vec, top);
3313 ucl_array_find_index (const ucl_object_t *top, unsigned int index)
3315 UCL_ARRAY_GET (vec, top);
3325 ucl_array_index_of (ucl_object_t *top, ucl_object_t *elt)
3327 UCL_ARRAY_GET (vec, top);
3344 ucl_array_replace_index (ucl_object_t *top, ucl_object_t *elt,
3347 UCL_ARRAY_GET (vec, top);