IDZEBRA 2.2.11
insert.c File Reference
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "dict-p.h"

Go to the source code of this file.

Functions

static int dict_ins (Dict dict, const Dict_char *str, Dict_ptr back_ptr, int userlen, void *userinfo)
static void clean_page (Dict dict, Dict_ptr ptr, void *p, Dict_char *out, Dict_ptr subptr, char *userinfo)
static void checkPage (Dict dict, void *p)
static Dict_ptr new_page (Dict dict, Dict_ptr back_ptr, void **pp)
static int split_page (Dict dict, Dict_ptr ptr, void *p)
int dict_insert (Dict dict, const char *str, int userlen, void *userinfo)
 insert item into dictionary

Function Documentation

◆ checkPage()

void checkPage ( Dict dict,
void * p )
static

Definition at line 233 of file insert.c.

References dict, DICT_bsize, DICT_nodir, and DICT_size.

Referenced by clean_page(), and split_page().

◆ clean_page()

void clean_page ( Dict dict,
Dict_ptr ptr,
void * p,
Dict_char * out,
Dict_ptr subptr,
char * userinfo )
static

Definition at line 147 of file insert.c.

References checkPage(), dict, dict_bf_touch(), DICT_bsize, DICT_infoffset, DICT_nodir, DICT_size, dict_strlen(), and DICT_type.

Referenced by dict_ins(), and split_page().

◆ dict_ins()

int dict_ins ( Dict dict,
const Dict_char * str,
Dict_ptr back_ptr,
int userlen,
void * userinfo )
static

◆ dict_insert()

int dict_insert ( Dict dict,
const char * p,
int userlen,
void * userinfo )

insert item into dictionary

Parameters
dictdictionary handle
pstring-z with lookup string
userlenlength of user data (associated with p)
userinfouserdata (of size userlen)
Return values
0p is new and inserted OK
1p is updated (already exists) and userinfo is modified
2p already exists and userinfo is unmodified (same as before)
-1error

Definition at line 439 of file insert.c.

References dict, dict_ins(), and new_page().

Referenced by dict_insert_ord(), dirs_add(), dirs_mkdir(), heap_inpb(), heap_inpc(), heap_inps(), index_block_flush(), main(), and tst().

◆ new_page()

Dict_ptr new_page ( Dict dict,
Dict_ptr back_ptr,
void ** pp )
static

◆ split_page()

int split_page ( Dict dict,
Dict_ptr ptr,
void * p )
static

Definition at line 64 of file insert.c.

References checkPage(), clean_page(), dict, dict_bf_readp(), DICT_bsize, dict_ins(), DICT_nodir, dict_strlen(), and new_page().

Referenced by dict_ins().