JunkBox_Lib  1.10.2
tlist.h File Reference

Tiny List 構造ライブラリヘッダ More...

#include "buffer.h"
Include dependency graph for tlist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tList_data
 
struct  tList
 

Macros

#define TLIST_ANCHOR_NODE   JBXL_STATE_ANCHOR
 アンカーノード More...
 
#define TLIST_MATCH_COMPLETE   0
 完全一致 More...
 
#define TLIST_MATCH_TLISTKEY   -1
 リストのキーの長さに合わせる More...
 
#define TLIST_MATCH_STRINGKEY   -2
 比較する文字列の長さに合わせる More...
 
#define TLIST_MATCH_STRKEY   -2
 比較する文字列の長さに合わせる More...
 
#define make_tList_data_byBuffer(i, l, k, v, d, s)   make_tList_data((i), (l), (k), (v), (d), (s))
 make_tList_data() More...
 
#define make_tList_data_int(k, v)   make_tList_data_bystr((k), (v), NULL, NULL, NULL, 0)
 make_tList_data_bystr() More...
 
#define make_tList_data_str(k, v)   make_tList_data_bystr(0, 0, (char*)(k), (char*)(v), NULL, 0)
 make_tList_data_bystr() More...
 
#define make_tList_data_Buffer(k, v)   make_tList_data(0, 0, (k), (v), NULL, 0)
 make_tList_data() More...
 
#define new_tList_anchor()   add_tList_node_anchor()
 new_tList_anchor_node() More...
 
#define del_tList_anchor(t)   del_tList_anchor_node((t))
 del_tList_abchor_node() More...
 
#define add_tList_node_anchor()   add_tList_node_bystr(NULL, TLIST_ANCHOR_NODE, 0, NULL, NULL, NULL, 0)
 add_tList_node_bystr() More...
 
#define add_tList_node_int(p, k, v)   add_tList_node_bystr((p), (k), (v), NULL, NULL, NULL, 0)
 add_tList_node_bystr() More...
 
#define add_tList_node_str(p, k, v)   add_tList_node_bystr((p), 0, 0, (char*)(k), (char*)(v), NULL, 0)
 add_tList_node_bystr() More...
 
#define add_tList_node_null(p)   add_tList_node_bystr((p), 0, 0, NULL, NULL, NULL, 0)
 add_tList_node_bystr() More...
 
#define add_tList_node_Buffer(p, k, v)   add_tList_node_byBuffer((p), 0, 0, (k), (v), NULL, 0)
 add_tList_node_byBuffer() More...
 
#define set_tList_node_int(p, k, v)   set_tList_node_bystr((p), (k), (v), NULL, NULL, NULL, 0)
 set_tList_node_bystr() More...
 
#define set_tList_node_str(p, k, v)   set_tList_node_bystr((p), 0, 0, (char*)(k), (char*)(v), NULL, 0)
 set_tList_node_bystr() More...
 
#define set_tList_node_Buffer(p, k, v)   set_tList_node_byBuffer((p), 0, 0, (k), (v), NULL, 0)
 set_tList_node_byBuffer() More...
 
#define update_tList_node_int(p, k, v)   update_tList_node_bystr((p), (k), (v), NULL, NULL, NULL, 0)
 update_tList_node_bystr() More...
 
#define update_tList_node_str(p, k, v)   update_tList_node_bystr((p), 0, 0, (char*)(k), (char*)(v), NULL, 0)
 update_tList_node_bystr() More...
 
#define update_tList_node_Buffer(p, k, v)   update_tList_node_byBuffer((p), 0, 0, (k), (v), NULL, 0)
 update_tList_node_byBuffer() More...
 
#define add_tList(p, t)   insert_tList((p), (t))
 insert_tList() More...
 
#define add_tList_node(p, t)   insert_tList((p), (t))
 insert_tList() More...
 
#define insert_tList_node(p, t)   insert_tList((p), (t))
 insert_tList() More...
 
#define new_tList()   new_tList_node()
 new_tList_node() More...
 
#define get_strparam_tList(l, k, d)   get_str_param_tList((l), (k), (d))
 get_str_param_tList() More...
 
#define get_intparam_tList(l, k, d)   get_int_param_tList((l), (k), (d))
 get_intparam_tList() More...
 
#define get_doubleparam_tList(l, k, d)   get_double_param_tList((l), (k), (d))
 get_doubleparam_tList() More...
 
#define get_boolparam_tList(l, k, d)   get_bool_param_tList((l), (k), (d))
 get_boolparam_tList() More...
 

Functions

tList_data init_tList_data (void)
 空のノードデータを静的に作成.データを初期化するのに使用する. More...
 
tList_data make_tList_data (int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
 データを指定してノードデータを作成 More...
 
tList_data make_tList_data_bystr (int id, int lv, const char *key, const char *val, void *ptr, int sz)
 文字列データを指定してノードデータを作成 More...
 
void clear_tList_data (tList_data *ldat)
 ノードデータのバッファ部をクリアする.データ自身は削除しない. More...
 
void del_tList_data (tList_data **ldat)
 ノードデータを削除する. More...
 
tList_data dup_tList_data (tList_data ldat)
 ノードデータの複製を作成する More...
 
tListnew_tList_node (void)
 リスト用の空ノードを動的に生成する. More...
 
tList make_tList_node (tList_data data)
 リスト用ノードを静的に作成する. More...
 
tListdel_tList_node (tList **node)
 リスト用のノードを削除. More...
 
tListfree_tList_node (tList *node)
 リスト用ノードのバッファ部(データ)の解放. More...
 
tListdup_tList_node (tList *node)
 ノードデータを複製する (new).ノードのポインタは複製しない. More...
 
tListmove_tList_node (tList *pp, tList *node)
 nodeを現在のリストから切り離し,ppへ移動する. More...
 
tListswap_tList_node (tList *pp1, tList *pp2)
 pp1ノード と pp2ノードを入れ替える. More...
 
tListnew_tList_anchor_node (void)
 リスト用の ANCHORノードを動的に生成. More...
 
tListdel_tList_anchor_node (tList *node)
 ANCHORノードを削除して,TOPのポインターを返す. More...
 
tListadd_tList_node_bydata (tList *pp, tList_data ldat)
 データ(ldat)からリスト用ノードを生成し(new),それを指定したリストの後ろに追加. More...
 
tListadd_tList_node_bystr (tList *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
 文字列データからリスト用ノードを生成し(new),それをリストに追加. More...
 
tListadd_tList_node_byBuffer (tList *pp, int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
 Buffer データからリスト用ノードを生成し(new),それをリストに追加. More...
 
void set_tList_node_bydata (tList *pp, tList_data ldat)
 リストのノードに値を設定する. More...
 
void set_tList_node_bystr (tList *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
 文字列データからリストのノードに値を設定する.それぞれのデータは複製されて設定される. More...
 
void set_tList_node_byBuffer (tList *pp, int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
 リストのノードに値を設定する.それぞれのデータは複製されて設定される. More...
 
tListupdate_tList_node (tList *pp, tList *pt)
 pt->keyで検索し,ノードがあればノードをコピーする.無ければ最後にノードを追加する(new). More...
 
tListupdate_tList_node_bydata (tList *pp, char *key, tList_data ldat)
 keyで検索し,ノードがあればノードをコピーする.無ければ最後にノードを追加する(new). More...
 
tListupdate_tList_node_bystr (tList *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
 keyで検索し,ノードがあればノードをコピーする.無ければ最後に追加する(new) More...
 
tListupdate_tList_node_byBuffer (tList *pp, int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
 key.bufで検索し,ノードがあれば設定する.無ければ最後に追加する(new). More...
 
tListdel_tList (tList **pp)
 指定したリストノード以降のリストを削除. More...
 
void del_all_tList (tList **pp)
 リストの全ノードの削除.ポインタ ppのノードを含むリスト全体を削除する. More...
 
int del_tList_key (tList **pp, const char *key, int no)
 plからサーチして,no番目の keyのノードを削除する. More...
 
tListadd_tList_end (tList *pp, tList *pt)
 リストppの最後に リストptを追加する. More...
 
tListinsert_tList (tList *pp, tList *pt)
 ノードppの直ぐ後ろに ptを挿入する. More...
 
tListdup_tList (tList *pp)
 リストを複製する. More...
 
void print_tList (FILE *fp, tList *pp)
 リストの表示.ポインタ pp以降の全てのノードを fpに表示する. More...
 
void dump_tList (FILE *fp, tList *pp)
 val.buf を 16進ダンプする.他のデータは通常通り表示する. More...
 
int count_tList (tList *pp)
 リストの ppノード以降のノードの数を数える. More...
 
tListfind_tList_top (tList *pp)
 リストの最初のノードを探す. More...
 
tListfind_tList_end (tList *pp)
 リストの最後のノードを探す. More...
 
tListstrncmp_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードのサーチ. More...
 
tListstrnrvscmp_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードのサーチ.文字の後方から比べる More...
 
tListstrstr_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードの部分文字列サーチ. More...
 
tListstrncasecmp_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードのサーチ.大文字小文字を無視する More...
 
tListstrncaservscmp_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードのサーチ.文字の後方から比べる.大文字小文字を無視. More...
 
tListstrstrcase_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるノードの部分文字列サーチ.大文字小文字を無視. More...
 
tListstrncmp_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードのサーチ. More...
 
tListstrnrvscmp_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードのサーチ.文字も後方から比べる. More...
 
tListstrstr_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードの部分文字列サーチ. More...
 
tListstrncasecmp_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードのサーチ.大文字小文字を無視. More...
 
tListstrncaservscmp_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数によるリストの後方からのノードのサーチ.文字も後方から比べる.大文字小文字を無視. More...
 
tListstrstrcase_back_tList (tList *pl, const char *key, int len, int no)
 char* 型変数による後方からのノードの部分文字列サーチ.大文字小文字を無視. More...
 
tListsearch_id_tList (tList *lt, int id, int no)
 リストの中から no番目の idノード(ldat.id)を探し出し,tListのポインタを返す. More...
 
tListsearch_key_tList (tList *lt, const char *key, int no)
 リストの中から no番目の keyノード(ldat.key)を探し出し,tListへのポインタを返す.大文字小文字を無視. More...
 
Buffer buffer_key_tList (tList *lt, const char *key, int no)
 リストの中から no番目の keyノード(ldat.key)を探し出し,ldat.valのコピーを返す. More...
 
Buffer buffer_key_value_tList (tList *lt, const char *key, char *data, int no)
 リストの中から no番目の keyノードを探し出し,ノード値が data で始まる場合,そのノード値を返す. More...
 
tListawk_tList (char *str, char cc)
 文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す. More...
 
tListcawk_tList (char *str, char cc)
 文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.連続文字列対応. More...
 
tListawk_Buffer_tList (Buffer buf, char cc)
 Buffer 中の文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す. More...
 
tListcawk_Buffer_tList (Buffer buf, char cc)
 Buffer 中の文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.連続文字列対応. More...
 
char * get_str_join_tList (tList *lp, const char *deli)
 リストの一連のキー部を deliを区切りにして結合して,その文字列を返す. 要 free More...
 
Buffer get_Buffer_join_tList (tList *lp, const char *deli)
 リストの一連のキー部を deliを区切りにして結合して返す. More...
 
int set_value_tList (tList *lt, const char *key, int no, const char *value, int mode)
 リスト(lt)中の no番目の keyノードの値に valueを設定する. More...
 
int replace_value_tList (tList *lt, const char *key, int no, const char *srcval, char *value)
 リスト(lt)中の no番目の keyノードの値の srcvalの部分を value に置き換える. More...
 
int set_value_tList_node (tList *lt, const char *value)
 lt->ldat.val に文字列を設定する(置き換える). More...
 
int replace_value_tList_node (tList *lt, const char *srcval, const char *value)
 lt->ldat.val のsrcval部分を value に置き換える. More...
 
char * get_str_param_tList (tList *lt, const char *key, const char *dflt)
 keyに対応する値を 文字列として読み出す.キーがない場合は,デフォルト値 dflt を返す.要 free(). More...
 
int get_int_param_tList (tList *lt, const char *key, int dflt)
 keyに対応する値を 整数として読み出す.キーがない場合は,デフォルト値 dflt を返す.. More...
 
double get_double_param_tList (tList *lt, const char *key, double dflt)
 keyに対応する値を double型実数として読み出す.キーがない場合は,デフォルト値 dflt を返す. More...
 
float get_float_param_tList (tList *lt, const char *key, float dflt)
 keyに対応する値を float型実数として読み出す.キーがない場合は,デフォルト値 dflt を返す. More...
 
int get_bool_param_tList (tList *lt, const char *key, int dflt)
 keyに対応する値を 論理値(実際は整数)として読み出す.キーがない場合は,デフォルト値 dflt を返す. More...
 
tListread_tList_fp (FILE *fp, int mode)
 ファイルポインタが示すファイルから一行ずつ読み込んでリストのキー部に格納. More...
 
tListread_tList_file (const char *fn, int mode)
 ファイルから一行ずつ読み込んでリストのキー部に格納.空行はリストに加えない. More...
 
tListread_index_tList_fp (FILE *fp, char deli)
 ファイルポインタが示すファイルから一行ずつ読み込んで,deliを区切り文字にしてリストのキー部とデータ部に格納. More...
 
tListread_index_tList_file (const char *fn, char deli)
 ファイルから一行ずつ読み込んで,deliを区切り文字にしてリストのキー部とデータ部に格納. More...
 
tListread_Buffer_tList_fp (FILE *fp)
 ファイルポインタから Buffer型変数を 2つずつ読み込んで,リストのキー部とバッファ部に格納し返す. More...
 
tListread_Buffer_tList_file (const char *fn)
 ファイルから Buffer型変数を 2つずつ読み込んで,リストのキー部とバッファ部に格納し返す. More...
 
int save_Buffer_tList_fp (FILE *fp, tList *lt)
 リストのキー部とバッファ部の Buffer型変数をファイルポンタが指すファイルへ書き込む. More...
 
int save_Buffer_tList_file (const char *fn, tList *lt)
 リストのキー部とバッファ部の Buffer型変数をファイルへ書き込む. More...
 

Detailed Description

Version
Author
Fumi.Iseki (C)
Date
2008 2/1
See also
tList (_tList)

Definition in file tlist.h.

Macro Definition Documentation

◆ add_tList

#define add_tList (   p,
 
)    insert_tList((p), (t))

Definition at line 178 of file tlist.h.

◆ add_tList_node

#define add_tList_node (   p,
 
)    insert_tList((p), (t))

Definition at line 179 of file tlist.h.

◆ add_tList_node_anchor

#define add_tList_node_anchor ( )    add_tList_node_bystr(NULL, TLIST_ANCHOR_NODE, 0, NULL, NULL, NULL, 0)

Definition at line 140 of file tlist.h.

◆ add_tList_node_Buffer

#define add_tList_node_Buffer (   p,
  k,
 
)    add_tList_node_byBuffer((p), 0, 0, (k), (v), NULL, 0)

Definition at line 144 of file tlist.h.

◆ add_tList_node_int

#define add_tList_node_int (   p,
  k,
 
)    add_tList_node_bystr((p), (k), (v), NULL, NULL, NULL, 0)

Definition at line 141 of file tlist.h.

◆ add_tList_node_null

#define add_tList_node_null (   p)    add_tList_node_bystr((p), 0, 0, NULL, NULL, NULL, 0)

Definition at line 143 of file tlist.h.

◆ add_tList_node_str

#define add_tList_node_str (   p,
  k,
 
)    add_tList_node_bystr((p), 0, 0, (char*)(k), (char*)(v), NULL, 0)

Definition at line 142 of file tlist.h.

◆ del_tList_anchor

#define del_tList_anchor (   t)    del_tList_anchor_node((t))

Definition at line 133 of file tlist.h.

◆ get_boolparam_tList

#define get_boolparam_tList (   l,
  k,
 
)    get_bool_param_tList((l), (k), (d))

Definition at line 237 of file tlist.h.

◆ get_doubleparam_tList

#define get_doubleparam_tList (   l,
  k,
 
)    get_double_param_tList((l), (k), (d))

Definition at line 236 of file tlist.h.

◆ get_intparam_tList

#define get_intparam_tList (   l,
  k,
 
)    get_int_param_tList((l), (k), (d))

Definition at line 235 of file tlist.h.

◆ get_strparam_tList

#define get_strparam_tList (   l,
  k,
 
)    get_str_param_tList((l), (k), (d))

Definition at line 234 of file tlist.h.

◆ insert_tList_node

#define insert_tList_node (   p,
 
)    insert_tList((p), (t))

Definition at line 180 of file tlist.h.

◆ make_tList_data_Buffer

#define make_tList_data_Buffer (   k,
 
)    make_tList_data(0, 0, (k), (v), NULL, 0)

Definition at line 112 of file tlist.h.

◆ make_tList_data_byBuffer

#define make_tList_data_byBuffer (   i,
  l,
  k,
  v,
  d,
 
)    make_tList_data((i), (l), (k), (v), (d), (s))

Definition at line 109 of file tlist.h.

◆ make_tList_data_int

#define make_tList_data_int (   k,
 
)    make_tList_data_bystr((k), (v), NULL, NULL, NULL, 0)

Definition at line 110 of file tlist.h.

◆ make_tList_data_str

#define make_tList_data_str (   k,
 
)    make_tList_data_bystr(0, 0, (char*)(k), (char*)(v), NULL, 0)

Definition at line 111 of file tlist.h.

◆ new_tList

#define new_tList ( )    new_tList_node()

Definition at line 181 of file tlist.h.

◆ new_tList_anchor

#define new_tList_anchor ( )    add_tList_node_anchor()

Definition at line 132 of file tlist.h.

◆ set_tList_node_Buffer

#define set_tList_node_Buffer (   p,
  k,
 
)    set_tList_node_byBuffer((p), 0, 0, (k), (v), NULL, 0)

Definition at line 152 of file tlist.h.

◆ set_tList_node_int

#define set_tList_node_int (   p,
  k,
 
)    set_tList_node_bystr((p), (k), (v), NULL, NULL, NULL, 0)

Definition at line 150 of file tlist.h.

◆ set_tList_node_str

#define set_tList_node_str (   p,
  k,
 
)    set_tList_node_bystr((p), 0, 0, (char*)(k), (char*)(v), NULL, 0)

Definition at line 151 of file tlist.h.

◆ TLIST_ANCHOR_NODE

#define TLIST_ANCHOR_NODE   JBXL_STATE_ANCHOR

Definition at line 92 of file tlist.h.

◆ TLIST_MATCH_COMPLETE

#define TLIST_MATCH_COMPLETE   0

Definition at line 96 of file tlist.h.

◆ TLIST_MATCH_STRINGKEY

#define TLIST_MATCH_STRINGKEY   -2

Definition at line 98 of file tlist.h.

◆ TLIST_MATCH_STRKEY

#define TLIST_MATCH_STRKEY   -2

Definition at line 99 of file tlist.h.

◆ TLIST_MATCH_TLISTKEY

#define TLIST_MATCH_TLISTKEY   -1

Definition at line 97 of file tlist.h.

◆ update_tList_node_Buffer

#define update_tList_node_Buffer (   p,
  k,
 
)    update_tList_node_byBuffer((p), 0, 0, (k), (v), NULL, 0)

Definition at line 161 of file tlist.h.

◆ update_tList_node_int

#define update_tList_node_int (   p,
  k,
 
)    update_tList_node_bystr((p), (k), (v), NULL, NULL, NULL, 0)

Definition at line 159 of file tlist.h.

◆ update_tList_node_str

#define update_tList_node_str (   p,
  k,
 
)    update_tList_node_bystr((p), 0, 0, (char*)(k), (char*)(v), NULL, 0)

Definition at line 160 of file tlist.h.

Function Documentation

◆ add_tList_end()

tList* add_tList_end ( tList pp,
tList pt 
)

tList* add_tList_end(tList* pp, tList* pt)

リストppの最後に リストptを追加する.

Parameters
pp先頭のリストへのポインタ
pt追加するリストへのポインタ
Returns
リストの先頭へのポインタ
pp->1->2->3, pt->4->5 => pp->1->2->3->pt->4->5

Definition at line 877 of file tlist.c.

878 {
879  if (pt==NULL) return pp;
880  if (pp==NULL) return pt;
881 
882  tList* pe = find_tList_end(pp);
883  pe->next = pt;
884  pt->prev = pe;
885 
886  return pp;
887 }
tList * find_tList_end(tList *pl)
リストの最後のノードを探す.
Definition: tlist.c:1023

References find_tList_end().

Referenced by add_xml_attr(), get_dir_files_rcsv(), and read_ldap_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_tList_node_byBuffer()

tList* add_tList_node_byBuffer ( tList pp,
int  id,
int  lv,
Buffer  key,
Buffer  val,
void *  ptr,
int  sz 
)

tList* add_tList_node_byBuffer(tList* pp, int id, int lv, Buffer key, Buffer val, void* ptr, int sz)

Buffer データからリスト用ノードを生成し(new),それをリストに追加.

リストポインタ ppが指すノードの後につくり出した ノードを挿入する. sz>0 で ptr==NULL の場合は ptrの領域を確保し,0クリアする.

Parameters
pp追加する場所の手前のノードへのポインタ.
id追加するデータ.
lv追加するデータ.
key追加するデータ. 複製
val追加するデータ. 複製
*ptr汎用データへのポインタ 複製
sz*ptr のサイズ
Returns
追加したノードへのポインタ.

Definition at line 492 of file tlist.c.

493 {
494  tList* pt;
495  tList_data ldat;
496 
497  ldat = make_tList_data(id, lv, key, val, ptr, sz);
498  pt = add_tList_node_bydata(pp, ldat);
499 
500  return pt;
501 }
tList_data make_tList_data(int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
データを指定してノードデータを作成
Definition: tlist.c:50
tList * add_tList_node_bydata(tList *pp, tList_data ldat)
データ(ldat)からリスト用ノードを生成し(new),それを指定したリストの後ろに追加.
Definition: tlist.c:417

References add_tList_node_bydata(), and make_tList_data().

Referenced by read_index_tList_fp(), and update_tList_node_byBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_tList_node_bydata()

tList* add_tList_node_bydata ( tList pp,
tList_data  ldat 
)

tList* add_tList_node_bydata(tList* pp, tList_data ldat)

データ(ldat)からリスト用ノードを生成し(new),それを指定したリストの後ろに追加.
リストポインタ ppが指すノードの後につくり出した ノードを挿入する. ldat は指定されたものがそのまま使用される.

Parameters
pp追加する場所の手前のノードへのポインタ.
ldat追加するノードデータ.このデータがそのまま使用される.
Returns
追加したノードへのポインタ.

Definition at line 417 of file tlist.c.

418 {
419  tList* pt;
420 
421  pt = new_tList_node();
422  pt->ldat = ldat;
423 
424  if (pp==NULL) {
425  return pt;
426  }
427  //
428  if (pp->next==NULL) {
429  pt->next = NULL;
430  pt->prev = pp;
431  pp->next = pt;
432  return pt;
433  }
434 
435  pt->next = pp->next;
436  pt->prev = pp;
437  pp->next = pt;
438  pt->next->prev = pt;
439 
440  return pt;
441 }
tList * new_tList_node(void)
リスト用の空ノードを動的に生成する.
Definition: tlist.c:198

References new_tList_node().

Referenced by _add_key_val_list(), add_tList_node_byBuffer(), add_tList_node_bystr(), and update_tList_node_bydata().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_tList_node_bystr()

tList* add_tList_node_bystr ( tList pp,
int  id,
int  lv,
const char *  key,
const char *  val,
void *  ptr,
int  sz 
)

tList* add_tList_node_bystr(tList* pp, int id, int lv, const char* key, const char* val, void* ptr, int sz)

文字列データからリスト用ノードを生成し(new),それをリストに追加.

リストポインタ ppが指すノードの後につくり出した ノードを挿入する. sz>0 で ptr==NULL の場合は ptrの領域を確保し,0クリアする.

Parameters
pp追加する場所の手前のノードへのポインタ.
id追加するデータ.
lv追加するデータ.
key追加するデータ. 複製
val追加するデータ. 複製
ptr汎用データへのポインタ 複製
sz*ptr のサイズ
Returns
追加したノードへのポインタ.

Definition at line 462 of file tlist.c.

463 {
464  tList* pt;
465  tList_data ldat;
466 
467  ldat = make_tList_data_bystr(id, lv, key, val, ptr, sz);
468  pt = add_tList_node_bydata(pp, ldat);
469 
470  return pt;
471 }
tList_data make_tList_data_bystr(int id, int lv, const char *key, const char *val, void *ptr, int sz)
文字列データを指定してノードデータを作成
Definition: tlist.c:89

References add_tList_node_bydata(), and make_tList_data_bystr().

Referenced by awk_Buffer_tList(), awk_tList(), cawk_Buffer_tList(), cawk_tList(), jbxl_add_state(), and update_tList_node_bystr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ awk_Buffer_tList()

tList* awk_Buffer_tList ( Buffer  buf,
char  cc 
)

tList* awk_Buffer_tList(Buffer buf, char cc)

Buffer 中の文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.
項目が存在しない場合でもリストは返す(キー部の bufが NULL).

Parameters
buf処理する Buffer変数
cc項目の区切り文字
Returns
項目をキー部に入れたリスト.項目が存在しない場合でもリストは返す.
See also
cawk_Buffer_tList

Definition at line 1883 of file tlist.c.

1884 {
1885  int nn = 1;
1886  Buffer item;
1887  tList* lp = NULL;
1888 
1889  if (buf.buf==NULL) return NULL;
1890 
1891  item = awk_Buffer(buf, cc, nn);
1892  while (item.buf!=NULL) {
1893  lp = add_tList_node_bystr(lp, nn, 0, (char*)item.buf, NULL, NULL, 0);
1894  free_Buffer(&item);
1895  item = awk_Buffer(buf, cc, ++nn);
1896  }
1897 
1898  if (lp!=NULL) lp = find_tList_top(lp);
1899  return lp;
1900 }
void free_Buffer(Buffer *buf)
Buffer型変数のバッファ部を解放する
Definition: buffer.c:128
Buffer awk_Buffer(Buffer str, char cc, int n)
Buffer文字列に対する awk.
Definition: buffer.c:1050
unsigned char ** buf
Definition: jpeg_tool.h:96
Definition: buffer.h:35
unsigned char * buf
バッファの先頭へのポインタ.str[bufsz]は必ず 0x00となる.
Definition: buffer.h:39
tList * add_tList_node_bystr(tList *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
文字列データからリスト用ノードを生成し(new),それをリストに追加.
Definition: tlist.c:462
tList * find_tList_top(tList *pl)
リストの最初のノードを探す.
Definition: tlist.c:1002

References add_tList_node_bystr(), awk_Buffer(), buf, Buffer::buf, find_tList_top(), and free_Buffer().

Referenced by awk_Buffer_dim().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ awk_tList()

tList* awk_tList ( char *  str,
char  cc 
)

tList* awk_tList(char* str, char cc)

文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.
項目が存在しない場合でもリストは返す(キー部の bufが NULL).

Parameters
str処理する文字列
cc項目の区切り文字
Returns
項目をキー部に入れたリスト.項目が存在しない場合でもリストは返す.
See also
cawk_tList

Definition at line 1805 of file tlist.c.

1806 {
1807  int nn = 1;
1808  char* item;
1809  tList* lp = NULL;
1810 
1811  if (str==NULL) return NULL;
1812 
1813  lp = add_tList_node_bystr(NULL, 1, 0, NULL, NULL, NULL, 0);
1814 
1815  // first item
1816  item = awk(str, cc, nn);
1817  if (item==NULL) return lp;
1818  lp->ldat.key = make_Buffer_bystr(item);
1819 
1820  //
1821  item = awk(str, cc, ++nn);
1822  while (item!=NULL) {
1823  lp = add_tList_node_bystr(lp, nn, 0, item, NULL, NULL, 0);
1824  free(item);
1825  item = awk(str, cc, ++nn);
1826  }
1827 
1828  if (lp!=NULL) lp = find_tList_top(lp);
1829  return lp;
1830 }
#define make_Buffer_bystr(str)
set_Buffer()
Definition: buffer.h:57
char * awk(char *buf, char cc, int n)
ccを区切り記号として, strのバッファ内の n番目の項目を返す.要 free()
Definition: tools.c:567

References add_tList_node_bystr(), awk(), find_tList_top(), and make_Buffer_bystr.

Referenced by bvh_get_seq_data(), get_tList_line_Buffer(), and get_tList_seq_data_Buffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buffer_key_tList()

Buffer buffer_key_tList ( tList list,
const char *  key,
int  no 
)

Buffer buffer_key_tList(tList* list, const char* key, int no)

リストの中から no番目の keyノード(ldat.key)を探し出し,ldat.valのコピーを返す.
key はケースインセンシティブ.

Parameters
list検索を行うリストへのポインタ.
keyヘッダ種別.大文字,小文字を区別しない.
no何番目のノードを取り出すか指定する.1から数える.
Returns
ldat.val データのコピー.

Definition at line 1595 of file tlist.c.

1596 {
1597  tList* pp;
1598  Buffer buf;
1599 
1600  buf = init_Buffer();
1601  if (list==NULL || key==NULL) return buf;
1602  if (no<=0) no = 1;
1603 
1604  pp = strncasecmp_tList(list, key, 0, no); // 完全一致
1605  if (pp!=NULL) {
1606  buf = dup_Buffer(pp->ldat.val);
1607  }
1608 
1609  return buf;
1610 }
Buffer init_Buffer()
初期化したBuffer型変数を返す.
Definition: buffer.c:47
Buffer dup_Buffer(Buffer buf)
Buffer型変数のコピーをつくる.
Definition: buffer.c:211
tList * strncasecmp_tList(tList *pl, const char *key, int len, int no)
char* 型変数によるノードのサーチ.大文字小文字を無視する
Definition: tlist.c:1094

References buf, dup_Buffer(), init_Buffer(), and strncasecmp_tList().

Referenced by buffer_key_value_tList(), get_double_param_tList(), get_float_param_tList(), get_int_param_tList(), get_str_param_tList(), and read_ldap_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ buffer_key_value_tList()

Buffer buffer_key_value_tList ( tList list,
const char *  key,
char *  data,
int  no 
)

Buffer buffer_key_value_tList(tList* list, const char* key, char* data, int no)

リストの中から no番目の keyノードを探し出し,ノード値が data で始まる場合,そのノード値を返す.
key, dataはケースインセンシティブ.

Parameters
list検索を行うリストへのポインタ.
keyヘッダ種別. 大文字,小文字を区別しない.
dataチェックするノード値の最初の文字.
no何番目のノードを取り出すか指定する.1から数える.
Returns
ノード値の格納された Buffer型変数.

Definition at line 1626 of file tlist.c.

1627 {
1628  tList* pp;
1629  Buffer buf;
1630  char* str;
1631  int len;
1632 
1633  buf = init_Buffer();
1634  if (list==NULL || key==NULL) return buf;
1635  if (no<=0) no = 1;
1636 
1637  if (data==NULL) {
1638  buf = buffer_key_tList(list, key, no);
1639  return buf;
1640  }
1641 
1642  buf = init_Buffer();
1643  len = (int)strlen(data);
1644 
1645  pp = strncasecmp_tList(list, key, 0, no);
1646  if (pp!=NULL) {
1647  str = (char*)pp->ldat.val.buf;
1648  if (str!=NULL && !strncasecmp(str, data, len)) {
1649  buf = make_Buffer_bystr(str);
1650  return buf;
1651  }
1652  }
1653 
1654  return buf;
1655 }
unsigned char unsigned long * len
Definition: jpeg_tool.h:96
Buffer buffer_key_tList(tList *list, const char *key, int no)
リストの中から no番目の keyノード(ldat.key)を探し出し,ldat.valのコピーを返す.
Definition: tlist.c:1595

References buf, buffer_key_tList(), init_Buffer(), len, make_Buffer_bystr, and strncasecmp_tList().

Here is the call graph for this function:

◆ cawk_Buffer_tList()

tList* cawk_Buffer_tList ( Buffer  buf,
char  cc 
)

tList* cawk_Buffer_tList(Buffer buf, char cc)

Buffer 中の文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.
複数の区切り文字も1個と見なす.
項目が存在しない場合でもリストは返す(キー部の bufが NULL).

Parameters
buf処理する Buffer変数
cc項目の区切り文字
Returns
項目をキー部に入れたリスト.項目が存在しない場合でもリストは返す.

Definition at line 1914 of file tlist.c.

1915 {
1916  int nn = 1;
1917  Buffer item;
1918  tList* lp = NULL;
1919 
1920  if (buf.buf==NULL) return NULL;
1921 
1922  item = cawk_Buffer(buf, cc, nn);
1923  while (item.buf!=NULL) {
1924  lp = add_tList_node_bystr(lp, nn, 0, (char*)item.buf, NULL, NULL, 0);
1925  free_Buffer(&item);
1926  item = cawk_Buffer(buf, cc, ++nn);
1927  }
1928 
1929  if (lp!=NULL) lp = find_tList_top(lp);
1930  return lp;
1931 
1932 }
Buffer cawk_Buffer(Buffer str, char cc, int n)
Buffer文字列に対する(変形の)awk.
Definition: buffer.c:1094

References add_tList_node_bystr(), buf, Buffer::buf, cawk_Buffer(), find_tList_top(), and free_Buffer().

Referenced by cawk_Buffer_dim().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cawk_tList()

tList* cawk_tList ( char *  str,
char  cc 
)

tList* cawk_tList(char* str, char cc)

文字列を区切り文字で区切って,各項目をリストのキー部に入れて返す.
複数の区切り文字も1個と見なす.
項目が存在しない場合でもリストは返す(キー部の bufが NULL).

Parameters
str処理する文字列
cc項目の区切り文字
Returns
項目をキー部に入れたリスト.項目が存在しない場合でもリストは返す.

Definition at line 1844 of file tlist.c.

1845 {
1846  int nn = 1;
1847  char* item;
1848  tList* lp = NULL;
1849 
1850  if (str==NULL) return NULL;
1851 
1852  lp = add_tList_node_bystr(NULL, 1, 0, NULL, NULL, NULL, 0);
1853 
1854  // first item
1855  item = cawk(str, cc, nn);
1856  if (item==NULL) return lp;
1857  lp->ldat.key = make_Buffer_bystr(item);
1858 
1859  //
1860  item = cawk(str, cc, ++nn);
1861  while (item!=NULL) {
1862  lp = add_tList_node_bystr(lp, nn, 0, item, NULL, NULL, 0);
1863  free(item);
1864  item = cawk(str, cc, ++nn);
1865  }
1866 
1867  if (lp!=NULL) lp = find_tList_top(lp);
1868  return lp;
1869 }
char * cawk(char *buf, char cc, int n)
連続するccを区切り記号として, strのバッファ内の n番目の項目を返す.要 free()
Definition: tools.c:609

References add_tList_node_bystr(), cawk(), find_tList_top(), and make_Buffer_bystr.

Here is the call graph for this function:

◆ clear_tList_data()

void clear_tList_data ( tList_data ldat)

void clear_tList_data(tList_data* ldat)

ノードデータのバッファ部をクリアする.データ自身は削除しない.

Parameters
ldatクリアするノードデータ

Definition at line 120 of file tlist.c.

121 {
122  if (ldat==NULL) return;
123 
124  ldat->id = 0;
125  ldat->lv = 0;
126  ldat->sz = 0;
127 
128  free_Buffer(&(ldat->key));
129  free_Buffer(&(ldat->val));
130  if (ldat->ptr!=NULL) free(ldat->ptr);
131  del_all_tList(&(ldat->lst));
132 
133  ldat->key = init_Buffer();
134  ldat->val = init_Buffer();
135  ldat->ptr = NULL;
136  ldat->lst = NULL;
137 
138  return;
139 }
void del_all_tList(tList **pp)
リストの全ノードの削除.ポインタ ppのノードを含むリスト全体を削除する.
Definition: tlist.c:769

References del_all_tList(), free_Buffer(), and init_Buffer().

Referenced by del_sisters_children_tTree(), del_tList(), del_tList_data(), del_tTree(), free_tList_node(), free_tTree_node(), json_insert_child(), and set_tList_node_bydata().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ count_tList()

int count_tList ( tList pp)

int count_tList(tList* pp)

リストの ppノード以降のノードの数を数える.

Parameters
pp数え始めるノードへのポインタ.
Returns
ノードの数.

Definition at line 979 of file tlist.c.

980 {
981  int cnt = 0;
982 
983  while (pp!=NULL) {
984  cnt++;
985  pp = pp->next;
986  }
987  return cnt;
988 }

Referenced by print_sister_xml_tree(), and print_xml_node().

Here is the caller graph for this function:

◆ del_all_tList()

void del_all_tList ( tList **  pp)

void del_all_tList(tList** pp)

リストの全ノードの削除.ポインタ ppのノードを含むリスト全体を削除する.
但し altp のリンク先は削除しない. pp はりスト中であれば,どこを指していても良い.

Parameters
[in]*pp削除を開始するノードへのポインタ.
[out]*ppNULL

Definition at line 769 of file tlist.c.

770 {
771  tList* pm;
772  tList* pv;
773 
774  if (pp==NULL || *pp==NULL) return;
775 
776  pm = *pp;
777  pv = (*pp)->prev;
778 
779  do {
780  pm = del_tList_node(&pm);
781  } while (pm!=NULL);
782 
783  pm = pv;
784  while (pm!=NULL) {
785  pv = pm->prev;
786  del_tList_node(&pm);
787  pm = pv;
788  }
789 
790  *pp = NULL;
791 }
tList * del_tList_node(tList **node)
リスト用のノードを削除.
Definition: tlist.c:270

References del_tList_node().

Referenced by _copy_tTree_byctrl(), add_resource_list(), awk_Buffer_dim(), cawk_Buffer_dim(), clear_tList_data(), get_mime_filename(), read_index_tList_fp(), read_ipaddr_file(), read_ipaddr_fp(), read_ldap_config(), and set_xml_attr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ del_tList()

tList* del_tList ( tList **  pp)

tList* del_tList(tList** pp)

指定したリストノード以降のリストを削除.

Parameters
[in]*pp削除するノードへのポインタ.
[out]*ppNULL
Returns
削除したノード(s)の親ノードへのポインタ.

Definition at line 735 of file tlist.c.

736 {
737  tList* pt;
738  tList* pm;
739  tList* pw;
740 
741  if (pp==NULL || *pp==NULL) return NULL;
742 
743  pt = (*pp)->prev;
744  if (pt!=NULL) pt->next = NULL;
745 
746  pm = *pp;
747  while (pm!=NULL) {
748  pw = pm;
749  pm = pm->next;
750  clear_tList_data(&(pw->ldat));
751  free(pw);
752  }
753  *pp = NULL;
754 
755  return pt;
756 }
void clear_tList_data(tList_data *ldat)
ノードデータのバッファ部をクリアする.データ自身は削除しない.
Definition: tlist.c:120

References clear_tList_data().

Referenced by bvh_find_line(), bvh_parse_data(), bvh_parse_hierarchy(), bvh_parse_motion(), get_dir_files_rcsv(), jbxl_init_state_info(), recv_http_Buffer(), replace_sdp_invite_addr(), rm_dir_rcsv(), set_xml_content_list(), simple_web_proxy(), and www2browser_relay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ del_tList_anchor_node()

tList* del_tList_anchor_node ( tList node)

Definition at line 387 of file tlist.c.

388 {
389  tList* pp = node;
390 
391  if (node!=NULL && node->ldat.id==TLIST_ANCHOR_NODE) {
392  pp = node->next;
393  free_tList_node(node);
394  free(node);
395  }
396 
397  return pp;
398 }
tList * free_tList_node(tList *node)
リスト用ノードのバッファ部(データ)の解放.
Definition: tlist.c:243
#define TLIST_ANCHOR_NODE
アンカーノード
Definition: tlist.h:92

References free_tList_node(), and TLIST_ANCHOR_NODE.

Here is the call graph for this function:

◆ del_tList_data()

void del_tList_data ( tList_data **  ldat)

void del_tList_data(tList_data** ldat)

ノードデータを削除する.

Parameters
ldatクリアするノードデータ

Definition at line 149 of file tlist.c.

150 {
151  if (ldat==NULL || *ldat==NULL) return;
152 
153  clear_tList_data(*ldat);
154  *ldat = NULL;
155 
156  return;
157 }

References clear_tList_data().

Here is the call graph for this function:

◆ del_tList_key()

int del_tList_key ( tList **  pl,
const char *  key,
int  no 
)

int del_tList_key(tList* pl, const char* key, int no)

plからサーチして,no番目の keyのノードを削除する.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー(文字列).大文字,小文字を区別しない.
no一致した物の中で何番目の物を削除するか指定する.1から数える.0の場合は全て削除する.
Returns
削除したノードの数.

Definition at line 805 of file tlist.c.

806 {
807  int dl = 0;
808  int nn = 0;
809  if (no<0) no = 0;
810 
811  tList* pp = *pl;
812 
813  while (pp!=NULL) {
814  if (ex_strncasecmp((char*)(pp->ldat).key.buf, key, 0)) {
815  nn++;
816  if (no==0 || no==nn) {
817  if (pp->prev==NULL) *pl = pp->next;
818  pp = del_tList_node(&pp);
819  dl++;
820  if (no!=0) break;
821  }
822  else {
823  pp = pp->next;
824  }
825  }
826  else {
827  pp = pp->next;
828  }
829  }
830 
831  return dl;
832 }
int ex_strncasecmp(const char *dat, const char *key, int len)
文字列 s1とs2を拡張比較する.大文字小文字を区別しない.一致するなら TRUE
Definition: tools.c:820

References del_tList_node(), and ex_strncasecmp().

Here is the call graph for this function:

◆ del_tList_node()

tList* del_tList_node ( tList **  node)

tList* del_tList_node(tList** node)

リスト用のノードを削除. リストポインタ nodeが指すノードを削除し,リスト構造を詰める.

Parameters
[in]*node削除ノードへのポインタ.
[out]*nodeNULL
Returns
削除したノードの直後のノードへのポインタ.

Definition at line 270 of file tlist.c.

271 {
272  if (node==NULL || *node==NULL) return NULL;
273 
274  tList* pp = free_tList_node(*node);
275  free(*node);
276  *node = NULL;
277 
278  return pp;
279 }

References free_tList_node().

Referenced by _add_key_val_list(), del_all_tList(), del_sip_record_route(), del_sip_record_route_all(), del_sip_via(), del_tList_key(), http_proxy_header_analyze(), replace_sdp_invite_addr(), and set_protocol_contents().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_tList()

void dump_tList ( FILE *  fp,
tList pp 
)

void dump_tList(FILE* fp, tList* pp)

val.buf を 16進ダンプする.他のデータは通常通り表示する.

Definition at line 952 of file tlist.c.

953 {
954  if (fp==NULL) fp = stderr;
955 
956  if (pp!=NULL) {
957  while(pp!=NULL) {
958  tList_data ld = pp->ldat;
959  fprintf(fp, "[%d] [%d] [%s] [%d]\n", ld.id, ld.lv, ld.key.buf, ld.val.vldsz);
960  fdump(fp, (unsigned char*)ld.val.buf, ld.val.vldsz);
961  pp = pp->next;
962  }
963  }
964  else {
965  fprintf(fp, "(List is NULL)\n");
966  }
967  return;
968 }
void fdump(FILE *fp, unsigned char *mesg, int n)
16進ダンプを吐き出す
Definition: tools.c:4177

References fdump().

Here is the call graph for this function:

◆ dup_tList()

tList* dup_tList ( tList pp)

tList* dup_tList(tList* pp)

リストを複製する.

Parameters
pp複製元のリストへのポインタ.
Returns
複製されたリストへのポインタ.

Definition at line 843 of file tlist.c.

844 {
845  tList* pt;
846  tList* pl;
847  tList* tt;
848 
849  if (pp==NULL) return NULL;
850 
851  pt = pl = dup_tList_node(pp);
852  pp = pp->next;
853 
854  while(pp!=NULL) {
855  tt = dup_tList_node(pp);
856  pl = insert_tList(pl, tt);
857  pp = pp->next;
858  }
859 
860  return pt;
861 }
tList * dup_tList_node(tList *node)
ノードデータを複製する (new).ノードのポインタは複製しない.
Definition: tlist.c:287
tList * insert_tList(tList *pp, tList *pt)
ノードppの直ぐ後ろに ptを挿入する.
Definition: tlist.c:903

References dup_tList_node(), and insert_tList().

Referenced by _copy_tTree_byctrl(), dup_tList_data(), get_dir_files_rcsv(), and set_xml_attr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dup_tList_data()

tList_data dup_tList_data ( tList_data  ldat)

tList_data dup_tList_data(tList_data ldat)

ノードデータの複製を作成する.
ldat.ptr にデータがあるなら,ldat.sz には正確にldat.ptrのサイズが設定されている必要がある.

Parameters
ldat複製するノードデータ
Returns
複製したノードデータへのポインタ.

Definition at line 169 of file tlist.c.

170 {
171  tList_data dup;
172 
173  memcpy(&dup, &ldat, sizeof(tList_data));
174  dup.key = dup_Buffer(ldat.key);
175  dup.val = dup_Buffer(ldat.val);
176  if (ldat.ptr!=NULL && ldat.sz>0) {
177  dup.ptr = (void*)malloc(ldat.sz);
178  if (dup.ptr!=NULL) memcpy(dup.ptr, ldat.ptr, ldat.sz);
179  }
180  dup.lst = dup_tList(ldat.lst);
181 
182  return dup;
183 }
tList * dup_tList(tList *pp)
リストを複製する.
Definition: tlist.c:843

References dup_Buffer(), and dup_tList().

Referenced by dup_tList_node().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dup_tList_node()

tList* dup_tList_node ( tList node)

tList* dup_tList_node(tList* node)

ノードデータを複製する (new).ノードのポインタは複製しない.

Definition at line 287 of file tlist.c.

288 {
289  tList* pp;
290  int sz;
291 
292  if (node==NULL) return NULL;
293 
294  sz = sizeof(tList);
295  pp = (tList*)malloc(sz);
296  if (pp==NULL) return NULL;
297 
298  memcpy(pp, node, sz);
299  pp->ldat = dup_tList_data(node->ldat);
300  pp->next = NULL;
301  pp->prev = NULL;
302  pp->altp = NULL;
303  pp->yngr = NULL;
304  pp->esis = NULL;
305  pp->ysis = NULL;
306 
307  return pp;
308 }
tList_data dup_tList_data(tList_data ldat)
ノードデータの複製を作成する
Definition: tlist.c:169

References dup_tList_data().

Referenced by dup_merge_tTree(), and dup_tList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_tList_end()

tList* find_tList_end ( tList pl)

tList* find_tList_end(tList* pl)

リストの最後のノードを探す.

Attention
リスト構造の最後のノードを探す関数なので,tTree 構造に適用しても正しいノードを見つけることは出来ない.
tTreeに対しては find_tTree_end()を使うこと.
Parameters
plサーチを開始するノードへのポインタ.
Returns
リストの最後のノードへのポインタ.

Definition at line 1023 of file tlist.c.

1024 {
1025  if (pl==NULL) return NULL;
1026 
1027  while (pl->next!=NULL) pl = pl->next;
1028  return pl;
1029 }

Referenced by add_resource_list(), add_tList_end(), check_match_tTree(), check_match_xml(), find_protocol_end(), insert_tList(), strncasecmp_back_tList(), strncaservscmp_back_tList(), strncmp_back_tList(), strnrvscmp_back_tList(), strstr_back_tList(), strstrcase_back_tList(), update_tList_node_byBuffer(), update_tList_node_bydata(), and update_tList_node_bystr().

Here is the caller graph for this function:

◆ find_tList_top()

tList* find_tList_top ( tList pl)

tList* find_tList_top(tList* pl)

リストの最初のノードを探す.

Parameters
plサーチを開始するノードへのポインタ.
Returns
リストの最初のノードへのポインタ.

Definition at line 1002 of file tlist.c.

1003 {
1004  if (pl==NULL) return NULL;
1005 
1006  while (pl->prev!=NULL) pl = pl->prev;
1007  return pl;
1008 }

Referenced by awk_Buffer_tList(), awk_tList(), cawk_Buffer_tList(), cawk_tList(), get_mime_filename(), get_protocol_header_list(), and recv_http_header().

Here is the caller graph for this function:

◆ free_tList_node()

tList* free_tList_node ( tList node)

tList* free_tList_node(tList* node)

リスト用ノードのバッファ部(データ)の解放.

Parameters
node解放するノードへのポインタ.
Returns
削除したノードの直後のノードへのポインタ.

Definition at line 243 of file tlist.c.

244 {
245  if (node==NULL) return NULL;
246 
247  clear_tList_data(&(node->ldat));
248 
249  tList* pp = NULL;
250  if (node->prev!=NULL) node->prev->next = node->next;
251  if (node->next!=NULL) {
252  node->next->prev = node->prev;
253  pp = node->next;
254  }
255 
256  return pp;
257 }

References clear_tList_data().

Referenced by del_tList_anchor_node(), and del_tList_node().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_bool_param_tList()

int get_bool_param_tList ( tList lt,
const char *  key,
int  dflt 
)

int get_bool_param_tList(tList* lt, const char* key, int dflt)

リストから keyに対応するデータ部を 論理値(実際は整数)として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.

Parameters
ltファイルから read_index_tList_file() を使用して読み込んだリスト.
key検索キー
dfltデフォルト値
Returns
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 2091 of file tlist.c.

2092 {
2093  int ret = dflt;
2094  char* val = NULL;
2095 
2096  if (dflt) val = get_str_param_tList(lt, key, "true");
2097  else val = get_str_param_tList(lt, key, "false");
2098 
2099  if (val!=NULL) {
2100  if (!strcasecmp("true", val)) ret = 1; // TRUE
2101  else ret = 0; // FALSE
2102  free(val);
2103  }
2104 
2105  return ret;
2106 }
char * get_str_param_tList(tList *lt, const char *key, const char *dflt)
keyに対応する値を 文字列として読み出す.キーがない場合は,デフォルト値 dflt を返す.要 free().
Definition: tlist.c:1994

References get_str_param_tList().

Here is the call graph for this function:

◆ get_Buffer_join_tList()

Buffer get_Buffer_join_tList ( tList lp,
const char *  deli 
)

Buffer get_Buffer_join_tList(tList* lp, const char* deli)

リストの一連のキー部を deliを区切りにして結合する.

Definition at line 1953 of file tlist.c.

1954 {
1955  Buffer buf;
1956 
1957  buf = init_Buffer();
1958  if (lp==NULL) return buf;
1959 
1960  buf = make_Buffer(LBUF);
1961 
1962  if (lp!=NULL && lp->ldat.key.buf!=NULL) {
1963  cat_s2Buffer((char*)lp->ldat.key.buf, &buf);
1964  lp = lp->next;
1965 
1966  while (lp!=NULL && lp->ldat.key.buf!=NULL) {
1967  if (deli!=NULL) cat_s2Buffer(deli, &buf);
1968  cat_s2Buffer((char*)lp->ldat.key.buf, &buf);
1969  lp = lp->next;
1970  }
1971  }
1972 
1973  return buf;
1974 }
Buffer make_Buffer(int sz)
Buffer型変数のバッファ部をつくり出す.
Definition: buffer.c:71
#define cat_s2Buffer(src, dst)
cat_b2Buffer()
Definition: buffer.h:122
#define LBUF
Definition: common.h:146

References buf, cat_s2Buffer, init_Buffer(), LBUF, and make_Buffer().

Referenced by get_str_join_tList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_double_param_tList()

double get_double_param_tList ( tList lt,
const char *  key,
double  dflt 
)

double get_double_param_tList(tList* lt, const char* key, double dflt)

リストから keyに対応するデータ部を double型実数として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.

Parameters
ltファイルから read_index_tList_file() を使用して読み込んだリスト.
key検索キー
dfltデフォルト値
Returns
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 2041 of file tlist.c.

2042 {
2043  Buffer buf;
2044 
2045  buf = buffer_key_tList(lt, key, 1);
2046  if (buf.buf!=NULL) {
2047  double ret = atof((char*)buf.buf);
2048  free_Buffer(&buf);
2049  return ret;
2050  }
2051  return dflt;
2052 }

References buf, buffer_key_tList(), and free_Buffer().

Here is the call graph for this function:

◆ get_float_param_tList()

float get_float_param_tList ( tList lt,
const char *  key,
float  dflt 
)

float get_float_param_tList(tList* lt, const char* key, float dflt)

リストから keyに対応するデータ部を floate型実数として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.

Parameters
ltファイルから read_index_tList_file() を使用して読み込んだリスト.
key検索キー
dfltデフォルト値
Returns
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 2066 of file tlist.c.

2067 {
2068  Buffer buf;
2069 
2070  buf = buffer_key_tList(lt, key, 1);
2071  if (buf.buf!=NULL) {
2072  float ret = (float)atof((char*)buf.buf);
2073  free_Buffer(&buf);
2074  return ret;
2075  }
2076  return dflt;
2077 }

References buf, buffer_key_tList(), and free_Buffer().

Here is the call graph for this function:

◆ get_int_param_tList()

int get_int_param_tList ( tList lt,
const char *  key,
int  dflt 
)

int get_int_param_tList(tList* lt, const char* key, int dflt)

リストから keyに対応するデータ部を 整数として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.

Parameters
ltファイルから read_index_tList_file() を使用して読み込んだリスト.
key検索キー
dfltデフォルト値
Returns
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 2016 of file tlist.c.

2017 {
2018  Buffer buf;
2019 
2020  buf = buffer_key_tList(lt, key, 1);
2021  if (buf.buf!=NULL) {
2022  int ret = atoi((char*)buf.buf);
2023  free_Buffer(&buf);
2024  return ret;
2025  }
2026  return dflt;
2027 }

References buf, buffer_key_tList(), and free_Buffer().

Here is the call graph for this function:

◆ get_str_join_tList()

char* get_str_join_tList ( tList lp,
const char *  deli 
)

char* get_str_join_tList(tList* lp, const char* deli)

リストの一連のキー部を deliを区切りにして結合して,その文字列を返す.
要 free()

Definition at line 1941 of file tlist.c.

1942 {
1943  Buffer buf = get_Buffer_join_tList(lp, deli);
1944  return (char*)buf.buf;
1945 }
Buffer get_Buffer_join_tList(tList *lp, const char *deli)
リストの一連のキー部を deliを区切りにして結合して返す.
Definition: tlist.c:1953

References buf, and get_Buffer_join_tList().

Here is the call graph for this function:

◆ get_str_param_tList()

char* get_str_param_tList ( tList lt,
const char *  key,
const char *  dflt 
)

char* get_str_param_tList(tList* lt, const char* key, const char* dflt)

リストから keyに対応するデータ部を 文字列として読み出す.キーがない場合は,デフォルト値 dflt を返す.
read_index_tList_file() と組み合わせて使用する.
要 free()

Parameters
ltファイルから read_index_tList_file() を使用して読み込んだリスト.
key検索キー
dfltデフォルト値
Returns
key に対応するデータ部.key がリストに存在しない場合は,dflt

Definition at line 1994 of file tlist.c.

1995 {
1996  Buffer buf;
1997 
1998  buf = buffer_key_tList(lt, key, 1);
1999  if (buf.buf==NULL) buf = make_Buffer_bystr(dflt);
2000 
2001  return (char*)buf.buf;
2002 }

References buf, buffer_key_tList(), and make_Buffer_bystr.

Referenced by get_bool_param_tList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_tList_data()

tList_data init_tList_data ( void  )

tList_data init_tList_data(void)

空のノードデータを静的に作成.データを初期化するのに使用する.

Returns
作られたノードデータ.

Definition at line 26 of file tlist.c.

27 {
28  tList_data pp;
29 
30  memset(&pp, 0, sizeof(tList_data));
31  return pp;
32 }

Referenced by new_tList_anchor_node(), new_tList_node(), new_tTree_anchor_node(), and new_tTree_node().

Here is the caller graph for this function:

◆ insert_tList()

tList* insert_tList ( tList pp,
tList pt 
)

tList* insert_tList(tList* pp, tList* pt)

ノードppの直ぐ後ろに ptを挿入する.

Parameters
pp先頭のリストへのポインタ
pt挿入するリストへのポインタ
Returns
挿入した先頭のリストへのアドレス.
pp->1->2->3, pt->4->5 => pp->pt->4->5->1->2->3

Definition at line 903 of file tlist.c.

904 {
905  tList* pe;
906 
907  if (pt==NULL) return pp;
908  if (pp==NULL) return pt;
909 
910  pe = find_tList_end(pt);
911  if (pp->next!=NULL) pp->next->prev = pe;
912  pe->next = pp->next;
913  pp->next = pt;
914  pt->prev = pp;
915 
916  return pt;
917 }

References find_tList_end().

Referenced by _find_match_tTree_endlist_rcsv(), _find_match_xml_endlist_rcsv(), and dup_tList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_tList_data()

tList_data make_tList_data ( int  id,
int  lv,
Buffer  key,
Buffer  val,
void *  ptr,
int  sz 
)

tList_data make_tList_data(int id, int lv, Buffer key, Buffer val, void* ptr, int sz)

データを指定してノードデータを作成
sz>0 で ptr==NULL の場合は ptrの領域を確保し,0クリアする.

Parameters
idノードのID
lvノードのデータ
keyノードのキー (Buffer) 複製
valノードのデータ (Buffer) 複製
ptr汎用データへのポインタ 複製
sz*ptr のサイズ
Returns
作られたノードデータ.

Definition at line 50 of file tlist.c.

51 {
52  tList_data pp;
53 
54  memset(&pp, 0, sizeof(tList_data));
55 
56  pp.id = id;
57  pp.lv = lv;
58  pp.sz = sz;
59  pp.key = dup_Buffer(key);
60  pp.val = dup_Buffer(val);
61 
62  if (sz>0) {
63  pp.ptr = (void*)malloc(sz);
64  if (pp.ptr!=NULL) {
65  if (ptr!=NULL) memcpy(pp.ptr, ptr, sz);
66  else memset(pp.ptr, 0, sz);
67  }
68  }
69 
70  return pp;
71 }

References dup_Buffer().

Referenced by add_tList_node_byBuffer(), add_tTree_node_byBuffer(), and insert_tTree_node_byBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_tList_data_bystr()

tList_data make_tList_data_bystr ( int  id,
int  lv,
const char *  key,
const char *  val,
void *  ptr,
int  sz 
)

tList_data make_tList_data_bystr(int id, int lv, const char* key, const char* val, void* ptr, int sz)

文字列データを指定してノードデータを作成
sz>0 で ptr==NULL の場合は ptrの領域を確保し,0クリアする.

Parameters
idノードのID
lvノードのデータ
keyノードのキー 複製
valノードのデータ 複製
ptr汎用データへのポインタ 複製
sz*ptr のサイズ
Returns
作られたノードデータ.

Definition at line 89 of file tlist.c.

90 {
91  tList_data pp;
92 
93  memset(&pp, 0, sizeof(tList_data));
94 
95  pp.id = id;
96  pp.lv = lv;
97  pp.sz = sz;
98  pp.key = make_Buffer_bystr(key); // key==NULLなら init_Buffer()
99  pp.val = make_Buffer_bystr(val);
100 
101  if (sz>0) {
102  pp.ptr = (void*)malloc(sz);
103  if (pp.ptr!=NULL) {
104  if (ptr!=NULL) memcpy(pp.ptr, ptr, sz);
105  else memset(pp.ptr, 0, sz);
106  }
107  }
108 
109  return pp;
110 }

References make_Buffer_bystr.

Referenced by add_tList_node_bystr(), add_tTree_node_bystr(), and insert_tTree_node_bystr().

Here is the caller graph for this function:

◆ make_tList_node()

tList make_tList_node ( tList_data  ldat)

tList make_tList_node(tList_data ldat)

リスト用ノードを静的に作成する.
ldat はそのまま新しい変数内で使用される.(単純に代入される)

この関数で生成したノードを del_*_tList()関数で削除してはいけない.

Parameters
ldatノードデータ
Returns
作られたノード.

Definition at line 223 of file tlist.c.

224 {
225  tList pp;
226 
227  memset(&pp, 0, sizeof(tList));
228  pp.ldat = ldat;
229  pp.state = JBXL_NORMAL;
230 
231  return pp;
232 }
#define JBXL_NORMAL
正常
Definition: jbxl_state.h:32

References JBXL_NORMAL.

◆ move_tList_node()

tList* move_tList_node ( tList pp,
tList node 
)

tList* move_tList_node(tList* pp, tList* node)

nodeを現在のリストから切り離し,ppへ移動する.
nodeを削除しないで del_tList_node(), add_tList_node() を実行するようなもの.

Parameters
pp移動先で親となるノードへのポインタ.
node移動するノードへのポインタ.
Returns
移動したノードノードへのポインタ.

Definition at line 321 of file tlist.c.

322 {
323  if (pp==NULL || node==NULL) return NULL;
324 
325  if (node->prev!=NULL) node->prev->next = node->next;
326  if (node->next!=NULL) node->next->prev = node->prev;
327 
328  node->prev = pp;
329  node->next = pp->next;
330  if (pp->next!=NULL) pp->next->prev = node;
331  pp->next = node;
332 
333  return node;
334 }

◆ new_tList_anchor_node()

tList* new_tList_anchor_node ( void  )

Definition at line 371 of file tlist.c.

372 {
373  tList* pp;
374 
375  pp = (tList*)malloc(sizeof(tList));
376  if (pp==NULL) return NULL;
377  memset(pp, 0, sizeof(tList));
378  pp->ldat = init_tList_data();
379  pp->ldat.id = TLIST_ANCHOR_NODE;
380  pp->depth = -1;
381  pp->state = JBXL_STATE_ANCHOR; // TLIST_ANCHOR_NODE と同じ
382 
383  return pp;
384 }
#define JBXL_STATE_ANCHOR
アンカーノード
Definition: jbxl_state.h:30
tList_data init_tList_data(void)
空のノードデータを静的に作成.データを初期化するのに使用する.
Definition: tlist.c:26

References init_tList_data(), JBXL_STATE_ANCHOR, and TLIST_ANCHOR_NODE.

Referenced by add_resource_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ new_tList_node()

tList* new_tList_node ( void  )

tList* new_tList_node(void)

リスト用の空ノードを動的に生成する.

Returns
生成されたノードへのポインタ.

Definition at line 198 of file tlist.c.

199 {
200  tList* pp;
201 
202  pp = (tList*)malloc(sizeof(tList));
203  if (pp==NULL) return NULL;
204  memset(pp, 0, sizeof(tList));
205  pp->ldat = init_tList_data();
206  pp->state = JBXL_NORMAL;
207 
208  return pp;
209 }

References init_tList_data(), and JBXL_NORMAL.

Referenced by _find_match_tTree_endlist_rcsv(), _find_match_xml_endlist_rcsv(), _search_all_node_strval_json(), and add_tList_node_bydata().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_tList()

void print_tList ( FILE *  fp,
tList pp 
)

void print_tList(File* fp, tList* pp)

リストの表示.ポインタ pp以降の全てのノードを fpに表示する.

Parameters
fp出力するファイルへのポインタ.NULLの場合は stderr
pp表示を開始するノードへのポインタ.

Definition at line 928 of file tlist.c.

929 {
930  if (fp==NULL) fp = stderr;
931 
932  if (pp!=NULL) {
933  while(pp!=NULL) {
934  tList_data ld = pp->ldat;
935  fprintf(fp, "[%d] [%d] [%s] [%s]\n", ld.id, ld.lv, ld.key.buf, ld.val.buf);
936  //if (pp->next!=NULL) print_tList(pp->next);
937  pp = pp->next;
938  }
939  }
940  else {
941  fprintf(fp, "(List is NULL)\n");
942  }
943  return;
944 }

◆ read_Buffer_tList_file()

tList* read_Buffer_tList_file ( const char *  fname)

tList* read_Buffer_tList_file(const char* fname)

ファイルから Buffer型変数を 2つずつ読み込んで,リストのキー部とバッファ部に格納し返す.

Parameters
fnameファイル名.
Returns
格納したリストへのポインタ.

Definition at line 2286 of file tlist.c.

2287 {
2288  tList* lp = NULL;
2289  FILE* fp;
2290 
2291  fp = fopen(fname, "rb");
2292  if (fp!=NULL) {
2293  lp = read_Buffer_tList_fp(fp);
2294  fclose(fp);
2295  }
2296  return lp;
2297 }
tList * read_Buffer_tList_fp(FILE *fp)
ファイルポインタから Buffer型変数を 2つずつ読み込んで,リストのキー部とバッファ部に格納し返す.
Definition: tlist.c:2308

References read_Buffer_tList_fp().

Here is the call graph for this function:

◆ read_Buffer_tList_fp()

tList* read_Buffer_tList_fp ( FILE *  fp)

tList* read_Buffer_tList_fp(FILE* fp)

ファイルポインタから Buffer型変数を 2つずつ読み込んで,リストのキー部とバッファ部に格納し返す.

Parameters
fpファイルポインタ.
Returns
格納したリストへのポインタ.

Definition at line 2308 of file tlist.c.

2309 {
2310  int cc;
2311  tList* lp = NULL;
2312  tList* lt = NULL;
2313  Buffer key, val;
2314 
2315  if (fp==NULL) return NULL;
2316 
2317  cc = read_Buffer2_format_fp(&key, &val, fp);
2318  while (!feof(fp) && cc) {
2319  lt = add_tList_node_Buffer(lt, key, val);
2320  if (lp==NULL) lp = lt;
2321  free_Buffer(&key);
2322  free_Buffer(&val);
2323  cc = read_Buffer2_format_fp(&key, &val, fp);
2324  }
2325 
2326  free_Buffer(&key);
2327  free_Buffer(&val);
2328  return lp;
2329 }
int read_Buffer2_format_fp(Buffer *key, Buffer *buf, FILE *fp)
ファイル fp から 2つのBuffer型変数の keyと bufを読み込む.
Definition: buffer.c:1819
#define add_tList_node_Buffer(p, k, v)
add_tList_node_byBuffer()
Definition: tlist.h:144

References add_tList_node_Buffer, free_Buffer(), and read_Buffer2_format_fp().

Referenced by read_Buffer_tList_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_index_tList_file()

tList* read_index_tList_file ( const char *  fname,
char  deli 
)

tList* read_index_tList_file(const char* fname, char deli)

ファイルから一行ずつ読み込んで,deliを区切り文字にしてリストのキー部とデータ部に格納.
データ部に区切り記号が存在しても良い
キー部とデータ部の前後の空白,TAB, CR, LF は削除する.
空行はリストに加えない.::で始まる行はリストに加えない

Parameters
fnameファイル名.
deli区切り文字
Returns
格納したリストへのポインタ.

Definition at line 2219 of file tlist.c.

2220 {
2221  tList* lp = NULL;
2222  FILE* fp;
2223 
2224  fp = fopen(fname, "rb");
2225  if (fp!=NULL) {
2226  lp = read_index_tList_fp(fp, deli);
2227  fclose(fp);
2228  }
2229  return lp;
2230 }
tList * read_index_tList_fp(FILE *fp, char deli)
ファイルポインタが示すファイルから一行ずつ読み込んで,deliを区切り文字にしてリストのキー部とデータ部に格納.
Definition: tlist.c:2246

References read_index_tList_fp().

Referenced by read_ldap_config().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_index_tList_fp()

tList* read_index_tList_fp ( FILE *  fp,
char  deli 
)

tList* read_index_tList_fp(FILE* fp, char deli)

ファイルポインタが示すファイルから一行ずつ読み込んで,最初の deliを区切り文字にしてリストのキー部とデータ部に格納.
データ部に区切り記号が存在しても良い
キー部とデータ部の前後の空白,TAB, CR, LF は削除する.
空行はリストに加えない.::で始まる行はリストに加えない

Parameters
fpファイルポインタ.
deli区切り文字
Returns
格納したリストへのポインタ.

Definition at line 2246 of file tlist.c.

2247 {
2248  Buffer key, val;
2249  Buffer fst, snd;
2250  tList* pl;
2251  tList* pp;
2252  tList* lt = NULL;
2253 
2254  pp = pl = read_tList_fp(fp, 1);
2255  while (pp!=NULL) {
2256  fst = awk_Buffer(pp->ldat.key, deli, 1);
2257  //snd = awk_Buffer(pp->ldat.key, deli, 2);
2258  //snd = make_Buffer_bystr((char*)&(pp->ldat.key.buf[fst.vldsz]));
2259  snd = make_Buffer_bystr((char*)&(pp->ldat.key.buf[fst.vldsz]) + 1);
2260  key = pack_Buffer(fst, ' ');
2261  val = pack_Buffer(snd, ' ');
2262  if (lt==NULL) lt = add_tList_node_byBuffer(NULL, 0, 0, key, val, NULL, 0);
2263  else add_tList_node_byBuffer(lt, 0, 0, key, val, NULL, 0);
2264 
2265  free_Buffer(&key);
2266  free_Buffer(&val);
2267  free_Buffer(&fst);
2268  free_Buffer(&snd);
2269 
2270  pp = pp->next;
2271  }
2272  del_all_tList(&pl);
2273 
2274  return lt;
2275 }
Buffer pack_Buffer(Buffer buf, char cc)
文字列の先頭のcc(複数),終わりのcc(複数),TAB, CR, LF を削除
Definition: buffer.c:1134
int vldsz
データの長さ.バイナリデータの場合も使用可能.文字列の場合は 0x00 を含まない.
Definition: buffer.h:37
tList * add_tList_node_byBuffer(tList *pp, int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
Buffer データからリスト用ノードを生成し(new),それをリストに追加.
Definition: tlist.c:492
tList * read_tList_fp(FILE *fp, int mode)
ファイルポインタが示すファイルから一行ずつ読み込んでリストのキー部に格納.
Definition: tlist.c:2158

References add_tList_node_byBuffer(), awk_Buffer(), del_all_tList(), free_Buffer(), make_Buffer_bystr, pack_Buffer(), read_tList_fp(), and Buffer::vldsz.

Referenced by read_index_tList_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_tList_file()

tList* read_tList_file ( const char *  fname,
int  mode 
)

tList* read_tList_file(const char* fname, int mode)

ファイルから一行ずつ読み込んでリストのキー部に格納.空行はリストに加えない.

Parameters
fnameファイル名.
mode0: ファイルをそのまま読み込む.
mode1: 先頭が # の行はリストに加えない.また前後の空白を削除し,その他の連続する空白も1つの空白に変換する.
さらにタブは一個の空白として処理される.
mode2: 1の場合に加えて,途中の # 以降も無視する
Returns
格納したリストへのポインタ.

Definition at line 2127 of file tlist.c.

2128 {
2129  tList* lp = NULL;
2130  FILE* fp;
2131 
2132  fp = fopen(fname, "rb");
2133  if (fp!=NULL) {
2134  lp = read_tList_fp(fp, mode);
2135  fclose(fp);
2136  }
2137 
2138  return lp;
2139 }

References read_tList_fp().

Referenced by read_ipaddr_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_tList_fp()

tList* read_tList_fp ( FILE *  fp,
int  mode 
)

tList* read_tList_fp(FILE* fp, int mode)

ファイルポインタが示すファイルから一行ずつ読み込んでリストのキー部に格納.
空行はリストに加えない.

Parameters
fpファイルポインタ.
mode0: ファイルをそのまま読み込む.
mode1: 先頭が # の行はリストに加えない.また前後の空白を削除し,その他の連続する空白も1つの空白に変換する.
また,タブは一個の空白として処理される.
mode2: 1の場合に加えて,途中の # 以降も無視する
Returns
格納したリストへのポインタ.
Bug:
ディレクトリを読ませると,戻ってこない.

Definition at line 2158 of file tlist.c.

2159 {
2160  char val[LBUF+1];
2161  char* str;
2162  tList* lp = NULL;
2163  tList* lt = NULL;
2164 
2165  if (fp==NULL) return NULL;
2166 
2167  str = fgets(val, LBUF, fp); // str is unused
2168  while (!feof(fp)) {
2169  if (mode>0) {
2170  if (mode>1) {
2171  int i;
2172  for (i=0; i<(int)strlen(val); i++) {
2173  if (val[i]=='#') {
2174  val[i] = '\0';
2175  break;
2176  }
2177  if (i>=LBUF) break;
2178  }
2179  }
2180  str = pack_char(val, ' ');
2181  }
2182  else {
2183  str = (char*)malloc(LBUF+1);
2184  if (str!=NULL) {
2185  memset(str, 0, LBUF+1);
2186  strncpy(val, str, LBUF);
2187  }
2188  }
2189 
2190  if (str!=NULL) {
2191  if (strlen(str)>0) { // 空行のチェック
2192  if (mode==0 || str[0]!='#') {
2193  lt = add_tList_node_str(lt, str, NULL);
2194  if (lp==NULL) lp = lt;
2195  }
2196  }
2197  free(str);
2198  }
2199  str = fgets(val, LBUF, fp); // str is unused
2200  }
2201 
2202  return lp;
2203 }
#define add_tList_node_str(p, k, v)
add_tList_node_bystr()
Definition: tlist.h:142
#define pack_char(s, c)
pack_char_len()
Definition: tools.h:236

References add_tList_node_str, LBUF, and pack_char.

Referenced by read_index_tList_fp(), read_ipaddr_fp(), and read_tList_file().

Here is the caller graph for this function:

◆ replace_value_tList()

int replace_value_tList ( tList list,
const char *  key,
int  no,
const char *  srcval,
char *  value 
)

int replace_value_tList(tList* list, const char* key, int no, const char* srcval, char* value)

リスト(lt)中の no番目の keyノードの値の srcvalの部分を value に置き換える.

no が 0以下の場合は,全ての keyノードの値に対して置き換えが行われる.

Parameters
list処理対象のリスト
key置き換えを行うノードのキー部.大文字,小文字を区別しない.
srcval置き換え対象の文字列.NULLなら指定した項目の文字列全体.
value置き換えを行う文字列.
no何個目のノードを置き換えるか.1から数える.0以下の場合はkeyが一致する全てのノードを置き換える
Return values
設定されたノードの数指定されたノードが存在しない場合は(追加された場合も)0
負数エラー

Definition at line 1742 of file tlist.c.

1743 {
1744  int cn = 0;
1745  tList* pm;
1746 
1747  if (list==NULL || key==NULL || value==NULL) return JBXL_ARGS_ERROR;
1748  if (srcval==NULL) {
1749  return set_value_tList(list, key, no, value, OFF);
1750  }
1751 
1752  if (no>0) {
1753  pm = strncasecmp_tList(list, key, 0, no);
1754  if (pm!=NULL) {
1755  int rep = replace_value_tList_node(pm, srcval, value);
1756  if (rep) cn = 1;
1757  }
1758  }
1759  else { // no<=0
1760  int nn = 1;
1761  cn = 0;
1762  pm = strncasecmp_tList(list, key, 0, nn);
1763  while (pm!=NULL) {
1764  int rep = replace_value_tList_node(pm, srcval, value);
1765  if (rep) cn++;
1766  pm = strncasecmp_tList(list, key, 0, ++nn);
1767  }
1768  }
1769 
1770  return cn;
1771 }
#define OFF
Definition: common.h:231
#define JBXL_ARGS_ERROR
不正な引数(NULLなど)
Definition: jbxl_state.h:42
int replace_value_tList_node(tList *lp, const char *srcval, const char *value)
lt->ldat.val のsrcval部分を value に置き換える.
Definition: tlist.c:1779
int set_value_tList(tList *list, const char *key, int no, const char *value, int add_mode)
リスト(lt)中の no番目の keyノードの値に valueを設定する.
Definition: tlist.c:1675

References JBXL_ARGS_ERROR, OFF, replace_value_tList_node(), set_value_tList(), and strncasecmp_tList().

Here is the call graph for this function:

◆ replace_value_tList_node()

int replace_value_tList_node ( tList lp,
const char *  srcval,
const char *  value 
)

int replace_value_tList_node(tList* lp, const char* srcval, const char* value)

lt->ldat.val のsrcval部分を value に置き換える.

Definition at line 1779 of file tlist.c.

1780 {
1781  if (lp==NULL || value==NULL) return FALSE;
1782  if (srcval==NULL) {
1783  return set_value_tList_node(lp, value);
1784  }
1785 
1786  Buffer buf = replace_sBuffer(lp->ldat.val, srcval, value);
1787  free_Buffer(&lp->ldat.val);
1788  lp->ldat.val = buf;
1789 
1790  return TRUE;
1791 }
#define replace_sBuffer(buf, f, t)
replace_sBuffer()
Definition: buffer.h:175
#define TRUE
Definition: common.h:226
#define FALSE
Definition: common.h:223
int set_value_tList_node(tList *lp, const char *value)
lt->ldat.val に文字列を設定する(置き換える).
Definition: tlist.c:1714

References buf, FALSE, free_Buffer(), replace_sBuffer, set_value_tList_node(), and TRUE.

Referenced by replace_value_tList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_Buffer_tList_file()

int save_Buffer_tList_file ( const char *  fname,
tList lp 
)

int save_Buffer_tList_file(const char* fname, tList* lp)

リストのキー部とバッファ部の Buffer型変数をファイルへ書き込む.
ファイルが既にある場合は,追加書き込みされる.

Parameters
fnameファイル名.
lp書き込みを行うリストデータへのポインタ.
Return values
TRUE書き込み成功.
FALSE書き込み失敗

Definition at line 2344 of file tlist.c.

2345 {
2346  int ret=FALSE;
2347  FILE* fp;
2348 
2349  fp = fopen(fname, "ab");
2350  if (fp!=NULL) {
2351  ret = save_Buffer_tList_fp(fp, lp);
2352  fclose(fp);
2353  }
2354  return ret;
2355 }
int save_Buffer_tList_fp(FILE *fp, tList *lp)
リストのキー部とバッファ部の Buffer型変数をファイルポンタが指すファイルへ書き込む.
Definition: tlist.c:2370

References FALSE, and save_Buffer_tList_fp().

Here is the call graph for this function:

◆ save_Buffer_tList_fp()

int save_Buffer_tList_fp ( FILE *  fp,
tList lp 
)

int save_Buffer_tList_fp(FILE* fp, tList* lp)

リストのキー部とバッファ部の Buffer型変数をファイルポンタが指すファイルへ書き込む.
ファイルが既にある場合は,追加書き込みされる.

Parameters
fpファイルポインタ.
lp書き込みを行うリストデータへのポインタ.
Return values
TRUE書き込み成功.
FALSE書き込み失敗

Definition at line 2370 of file tlist.c.

2371 {
2372  int cc=TRUE;
2373 
2374  if (fp==NULL) return FALSE;
2375 
2376  while (lp!=NULL && cc) {
2377  cc = save_Buffer2_format_fp(lp->ldat.key, lp->ldat.val, fp);
2378  lp = lp->next;
2379  }
2380 
2381  if (!cc) return FALSE;
2382  return TRUE;
2383 }
int save_Buffer2_format_fp(Buffer key, Buffer buf, FILE *fp)
ファイル fp へ 2つのBuffer型変数 keyと bufを書き込む
Definition: buffer.c:1733

References FALSE, save_Buffer2_format_fp(), and TRUE.

Referenced by save_Buffer_tList_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ search_id_tList()

tList* search_id_tList ( tList pl,
int  id,
int  no 
)

tList* search_id_tList(tList* pl, int id, int no)

リストの中から no番目の idノード(ldat.id)を探し出し,tListのポインタを返す.
key はケースインセンシティブ.

Parameters
pl検索を行うリストへのポインタ.
idノードのid値.
no何番目のノードを取り出すか指定する.1から数える.
Returns
tList へのポインタ

Definition at line 1541 of file tlist.c.

1542 {
1543  int nn = 0;
1544 
1545  if (pl==NULL) return NULL;
1546  if (no<=0) no = 1;
1547 
1548  while (pl!=NULL) {
1549  if (pl->ldat.id == id) {
1550  nn++;
1551  if (no==nn) return pl;
1552  }
1553  pl = pl->next;
1554  }
1555  return NULL;
1556 }

Referenced by jbxl_fprint_state(), and jbxl_fprint_state_jp().

Here is the caller graph for this function:

◆ search_key_tList()

tList* search_key_tList ( tList pl,
const char *  key,
int  no 
)

tList* search_key_tList(tList* pl, const char* key, int no)

リストの中から no番目の keyノード(ldat.key)を探し出し,tListへのポインタを返す.
key はケースインセンシティブ.

Parameters
pl検索を行うリストへのポインタ.
keyノードキー.大文字,小文字を区別しない.
no何番目のノードを取り出すか指定する.1から数える.
Returns
tList へのポインタ

Definition at line 1571 of file tlist.c.

1572 {
1573  tList* pp;
1574  if (pl==NULL || key==NULL) return NULL;
1575  if (no<=0) no = 1;
1576 
1577  pp = strncasecmp_tList(pl, key, 0, no); // 完全一致
1578 
1579  return pp;
1580 }

References strncasecmp_tList().

Referenced by find_protocol_end().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_tList_node_byBuffer()

void set_tList_node_byBuffer ( tList pp,
int  id,
int  lv,
Buffer  key,
Buffer  val,
void *  ptr,
int  sz 
)

void set_tList_node_byBuffer(tList* pp, int id, int lv, Buffer key, Buffer val, void* ptr, int sz)

リストのノードに値を設定する.それぞれのデータは複製されて設定される.
key.buf, val.bufが NULLの場合は,その値はノードには設定されない.

Parameters
ppノード値を設定するノードへのポインタ
idノードのID
lvノードのデータ
keyノードのキー (Buffer) 複製
valノードのデータ (Buffer) 複製
ptr汎用データへのポインタ 複製
sz*ptr のサイズ

Definition at line 575 of file tlist.c.

576 {
577  if (pp==NULL) return;
578 
579  pp->ldat.id = id;
580  pp->ldat.lv = lv;
581 
582  if (pp->ldat.key.buf!=NULL) {
583  free_Buffer(&(pp->ldat.key));
584  pp->ldat.key = dup_Buffer(key);
585  }
586 
587  if (pp->ldat.val.buf!=NULL) {
588  free_Buffer(&(pp->ldat.val));
589  pp->ldat.val = dup_Buffer(val);
590  }
591 
592  if (sz>0 && ptr!=NULL) {
593  if (pp->ldat.ptr!=NULL) free(pp->ldat.ptr);
594  pp->ldat.ptr = (void*)malloc(sz);
595  if (pp->ldat.ptr!=NULL) memcpy(pp->ldat.ptr, ptr, sz);
596  }
597 }

References dup_Buffer(), and free_Buffer().

Referenced by update_tList_node_byBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_tList_node_bydata()

void set_tList_node_bydata ( tList node,
tList_data  dat 
)

void set_tList_node_bydata(tList* node, tList_data dat)

リストのノードに値を設定する.
ldat は指定されたものがそのまま使用される.

Parameters
node設定するノードへのポインタ.
dat設定するノードデータ.このデータがそのまま使用される.

Definition at line 513 of file tlist.c.

514 {
515  if (node==NULL) return;
516 
517  clear_tList_data(&(node->ldat));
518  node->ldat = dat;
519 }

References clear_tList_data().

Referenced by update_tList_node_bydata().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_tList_node_bystr()

void set_tList_node_bystr ( tList pp,
int  id,
int  lv,
const char *  key,
const char *  val,
void *  ptr,
int  sz 
)

void set_tList_node_bystr(tList* pp, int id, int lv, const char* key, const char* val, void* ptr, int sz)

文字列データから リストのノードに値を設定する.それぞれのデータは複製されて設定される.
key, valが NULLの場合は,その値はノードは設定されない.

Parameters
ppノード値を設定するノードへのポインタ
idノードのID
lvノードのデータ
keyノードのキー 複製
valノードのデータ 複製
ptr汎用データへのポインタ 複製
sz*ptr のサイズ

Definition at line 536 of file tlist.c.

537 {
538  if (pp==NULL) return;
539 
540  pp->ldat.id = id;
541  pp->ldat.lv = lv;
542  pp->ldat.sz = sz;
543 
544  if (key!=NULL) {
545  free_Buffer(&(pp->ldat.key));
546  pp->ldat.key = make_Buffer_bystr(key);
547  }
548  if (val!=NULL) {
549  free_Buffer(&(pp->ldat.val));
550  pp->ldat.val = make_Buffer_bystr(val);
551  }
552 
553  if (sz>0 && ptr!=NULL) {
554  if (pp->ldat.ptr!=NULL) free(pp->ldat.ptr);
555  pp->ldat.ptr = (void*)malloc(sz);
556  if (pp->ldat.ptr!=NULL) memcpy(pp->ldat.ptr, ptr, sz);
557  }
558 }

References free_Buffer(), and make_Buffer_bystr.

Referenced by update_tList_node_bystr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_value_tList()

int set_value_tList ( tList lt,
const char *  key,
int  no,
const char *  value,
int  mode 
)

Definition at line 1675 of file tlist.c.

1676 {
1677  int cn = 0;
1678  tList* pm;
1679 
1680  if (list==NULL || key==NULL || value==NULL) return JBXL_ARGS_ERROR;
1681 
1682  if (no>0) {
1683  pm = strncasecmp_tList(list, key, 0, no);
1684  if (pm!=NULL) {
1685  int rep = set_value_tList_node(pm, value);
1686  if (rep) cn = 1;
1687  }
1688  }
1689  else { // no<=0
1690  int nn = 1;
1691  cn = 0;
1692  pm = strncasecmp_tList(list, key, 0, nn);
1693  while (pm!=NULL) {
1694  int rep = set_value_tList_node(pm, value);
1695  if (rep) cn++;
1696  pm = strncasecmp_tList(list, key, 0, ++nn);
1697  }
1698  }
1699 
1700  // Not Found
1701  if (add_mode==ON && cn==0) {
1702  add_tList_node_str(list, key, value);
1703  }
1704 
1705  return cn;
1706 }
#define ON
Definition: common.h:230

References add_tList_node_str, JBXL_ARGS_ERROR, ON, set_value_tList_node(), and strncasecmp_tList().

Referenced by replace_value_tList(), and set_protocol_header().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_value_tList_node()

int set_value_tList_node ( tList lp,
const char *  value 
)

int set_value_tList_node(tList* lp, const char* value)

lp->ldat.val に文字列を設定する(置き換える).

Definition at line 1714 of file tlist.c.

1715 {
1716  if (lp==NULL || value==NULL) return FALSE;
1717 
1718  Buffer buf = make_Buffer_bystr(value);
1719  free_Buffer(&lp->ldat.val);
1720  lp->ldat.val = buf;
1721 
1722  return TRUE;
1723 }

References buf, FALSE, free_Buffer(), make_Buffer_bystr, and TRUE.

Referenced by replace_value_tList_node(), and set_value_tList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ strncasecmp_back_tList()

tList* strncasecmp_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncasecmp_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードのサーチ.大文字小文字を無視する.
ポインタ pl以降のノードで,キー部の文字列が keyと前方一致(部分的も可)するノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー(文字列)
len1以上: 一致させる長さ.
lenTLIST_MATCH_COMPLETE (0): 完全一致.
lenTLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
lenTLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1337 of file tlist.c.

1338 {
1339  int nn = 0;
1340 
1341  if (pl==NULL || key==NULL) return NULL;
1342  if (len<=-3) return NULL;
1343  if (no<=0) no = 1;
1344 
1345  pl = find_tList_end(pl);
1346 
1347  while (pl!=NULL) {
1348  if (ex_strncasecmp((char*)(pl->ldat).key.buf, key, len)) {
1349  nn++;
1350  if (no==nn) return pl;
1351  }
1352  pl = pl->prev;
1353  }
1354  return NULL;
1355 }

References ex_strncasecmp(), find_tList_end(), and len.

Here is the call graph for this function:

◆ strncasecmp_tList()

tList* strncasecmp_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncasecmp_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードのサーチ.大文字小文字を無視する.

ポインタ pl以降のノードで,キー部の文字列が keyと前方一致(部分的も可)するノードの内, no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー(文字列)
len1以上: 一致させる長さ.
lenTLIST_MATCH_COMPLETE (0): 完全一致.
lenTLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
lenTLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no一致した物の中で何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1094 of file tlist.c.

1095 {
1096  int nn = 0;
1097 
1098  if (pl==NULL || key==NULL) return NULL;
1099  if (len<=-3) return NULL;
1100  if (no<=0) no = 1;
1101 
1102  while (pl!=NULL) {
1103  if (ex_strncasecmp((char*)(pl->ldat).key.buf, key, len)) {
1104  nn++;
1105  if (no==nn) return pl;
1106  }
1107  pl = pl->next;
1108  }
1109  return NULL;
1110 }

References ex_strncasecmp(), and len.

Referenced by _add_key_val_list(), add_resource_list(), buffer_key_tList(), buffer_key_value_tList(), get_max_forwards(), http_proxy_header_analyze(), insert_sip_record_route(), insert_sip_via(), recv_http_header(), replace_item_tList(), replace_sip_contact(), replace_sip_contact_dstipport(), replace_value_tList(), search_key_tList(), search_protocol_header(), set_item_tList(), set_max_forwards(), set_value_tList(), and www2browser_relay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ strncaservscmp_back_tList()

tList* strncaservscmp_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncaservscmp_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードのサーチ.文字も後方から比べる.大文字小文字を無視.
ポインタ pl以降のノードで,キー部の文字列が keyと後方一致(部分的も可)するノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー(文字列)
len1以上: 一致させる長さ.
lenTLIST_MATCH_COMPLETE (0): 完全一致.
lenTLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
lenTLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1413 of file tlist.c.

1414 {
1415  int nn = 0;
1416 
1417  if (pl==NULL || key==NULL) return NULL;
1418  if (len<=-3) return NULL;
1419  if (no<=0) no = 1;
1420 
1421  pl = find_tList_end(pl);
1422 
1423  while (pl!=NULL) {
1424  if (ex_strncaservscmp((char*)(pl->ldat).key.buf, key, len)) {
1425  nn++;
1426  if (no==nn) return pl;
1427  }
1428  pl = pl->prev;
1429  }
1430  return NULL;
1431 }
int ex_strncaservscmp(const char *dat, const char *key, int len)
文字列 s1とs2を後ろから拡張比較する.一致するなら TRUE
Definition: tools.c:892

References ex_strncaservscmp(), find_tList_end(), and len.

Here is the call graph for this function:

◆ strncaservscmp_tList()

tList* strncaservscmp_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncaservscmp_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードのサーチ.文字の後方から比べる.大文字小文字を無視.

ポインタ pl以降のノードで,キー部の文字列が keyと後方一致(部分的も可)するノードの内, no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー(文字列)
len1以上: 一致させる長さ.
lenTLIST_MATCH_COMPLETE (0): 完全一致.
lenTLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
lenTLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no一致した物の中で何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1170 of file tlist.c.

1171 {
1172  int nn = 0;
1173 
1174  if (pl==NULL || key==NULL) return NULL;
1175  if (len<=-3) return NULL;
1176  if (no<=0) no = 1;
1177 
1178  while (pl!=NULL) {
1179  if (ex_strncaservscmp((char*)(pl->ldat).key.buf, key, len)) {
1180  nn++;
1181  if (no==nn) return pl;
1182  }
1183  pl = pl->next;
1184  }
1185  return NULL;
1186 }

References ex_strncaservscmp(), and len.

Here is the call graph for this function:

◆ strncmp_back_tList()

tList* strncmp_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncmp_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードのサーチ.
ポインタ pl以降のノードで,キー部の文字列が keyと前方一致(部分的も可)するノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー(文字列)
len1以上: 一致させる長さ.
lenTLIST_MATCH_COMPLETE (0): 完全一致.
lenTLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
lenTLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1299 of file tlist.c.

1300 {
1301  int nn = 0;
1302 
1303  if (pl==NULL || key==NULL) return NULL;
1304  if (len<=-3) return NULL;
1305  if (no<=0) no = 1;
1306 
1307  pl = find_tList_end(pl);
1308 
1309  while (pl!=NULL) {
1310  if (ex_strncmp((char*)(pl->ldat).key.buf, key, len)) {
1311  nn++;
1312  if (no==nn) return pl;
1313  }
1314  pl = pl->prev;
1315  }
1316  return NULL;
1317 }
int ex_strncmp(const char *dat, const char *key, int len)
文字列 s1とs2を拡張比較する.一致するなら TRUE
Definition: tools.c:784

References ex_strncmp(), find_tList_end(), and len.

Here is the call graph for this function:

◆ strncmp_tList()

tList* strncmp_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strncmp_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードのサーチ.

ポインタ pl以降のノードで,キー部の文字列が keyと前方一致(部分的も可)するノードの内, no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー(文字列)
len1以上: 一致させる長さ.
lenTLIST_MATCH_COMPLETE (0): 完全一致.
lenTLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
lenTLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no一致した物の中で何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1056 of file tlist.c.

1057 {
1058  int nn = 0;
1059 
1060  if (pl==NULL || key==NULL) return NULL;
1061  if (len<=-3) return NULL;
1062  if (no<=0) no = 1;
1063 
1064  while (pl!=NULL) {
1065  if (ex_strncmp((char*)pl->ldat.key.buf, key, len)) {
1066  nn++;
1067  if (no==nn) return pl;
1068  }
1069  pl = pl->next;
1070  }
1071  return NULL;
1072 }

References ex_strncmp(), and len.

Referenced by insert_sip_record_route(), insert_sip_via(), restore_protocol_contents(), restore_protocol_header(), set_protocol_header(), update_tList_node_byBuffer(), update_tList_node_bydata(), and update_tList_node_bystr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ strnrvscmp_back_tList()

tList* strnrvscmp_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strnrvscmp_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードのサーチ.文字も後方から比べる.
ポインタ pl以降のノードで,キー部の文字列が keyと後方一致(部分的も可)するノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー(文字列)
len1以上: 一致させる長さ.
lenTLIST_MATCH_COMPLETE (0): 完全一致.
lenTLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
lenTLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1375 of file tlist.c.

1376 {
1377  int nn = 0;
1378 
1379  if (pl==NULL || key==NULL) return NULL;
1380  if (len<=-3) return NULL;
1381  if (no<=0) no = 1;
1382 
1383  pl = find_tList_end(pl);
1384 
1385  while (pl!=NULL) {
1386  if (ex_strnrvscmp((char*)(pl->ldat).key.buf, key, len)) {
1387  nn++;
1388  if (no==nn) return pl;
1389  }
1390  pl = pl->prev;
1391  }
1392  return NULL;
1393 }
int ex_strnrvscmp(const char *dat, const char *key, int len)
文字列 s1とs2を後ろから拡張比較する.一致するなら TRUE
Definition: tools.c:856

References ex_strnrvscmp(), find_tList_end(), and len.

Here is the call graph for this function:

◆ strnrvscmp_tList()

tList* strnrvscmp_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strnrvscmp_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードのサーチ.文字の後方から比べる.

ポインタ pl以降のノードで,キー部の文字列が keyと後方一致(部分的も可)するノードの内, no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー(文字列)
len1以上: 一致させる長さ.
lenTLIST_MATCH_COMPLETE (0): 完全一致.
lenTLIST_MATCH_TLISTKEY (-1): pl->key.buf の長さに合わせる.
lenTLIST_MATCH_STRINGKEY (-2): key の長さに合わせる.
no一致した物の中で何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1132 of file tlist.c.

1133 {
1134  int nn = 0;
1135 
1136  if (pl==NULL || key==NULL) return NULL;
1137  if (len<=-3) return NULL;
1138  if (no<=0) no = 1;
1139 
1140  while (pl!=NULL) {
1141  if (ex_strnrvscmp((char*)(pl->ldat).key.buf, key, len)) {
1142  nn++;
1143  if (no==nn) return pl;
1144  }
1145  pl = pl->next;
1146  }
1147  return NULL;
1148 }

References ex_strnrvscmp(), and len.

Here is the call graph for this function:

◆ strstr_back_tList()

tList* strstr_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strstr_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるリストの後方からのノードの部分文字列サーチ.

ポインタ pl以降のノードで,キー部の文字列または keyの文字列が相手の文字列に含まれる.
ノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー.
len0以上: key が plのキーに含まれるかどうか検査する.
len負数: plのキーが Keyに含まれるかどうか検査する.
no一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1451 of file tlist.c.

1452 {
1453  int nn = 0;
1454 
1455  if (pl==NULL || key==NULL) return NULL;
1456  if (no<=0) no = 1;
1457 
1458  pl = find_tList_end(pl);
1459 
1460  while (pl!=NULL) {
1461  if (len>=0) {
1462  if (strstr((char*)(pl->ldat).key.buf, key)!=NULL) {
1463  nn++;
1464  if (no==nn) return pl;
1465  }
1466  }
1467  else if (len<0) {
1468  if (strstr(key, (char*)(pl->ldat).key.buf)!=NULL) {
1469  nn++;
1470  if (no==nn) return pl;
1471  }
1472  }
1473 
1474  pl = pl->prev;
1475  }
1476  return NULL;
1477 }

References find_tList_end(), and len.

Here is the call graph for this function:

◆ strstr_tList()

tList* strstr_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strstr_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードの部分文字列サーチ.

ポインタ pl以降のノードで,キー部の文字列または keyの文字列が相手の文字列に含まれるノードの内, no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー.
len0以上: key が plのキーに含まれるかどうか検査する.
len負数: plのキーが Keyに含まれるかどうか検査する.
no一致した物の中で何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1206 of file tlist.c.

1207 {
1208  int nn = 0;
1209 
1210  if (pl==NULL || key==NULL) return NULL;
1211  if (no<=0) no = 1;
1212 
1213  while (pl!=NULL) {
1214  if (len>=0) {
1215  if (strstr((char*)(pl->ldat).key.buf, key)!=NULL) {
1216  nn++;
1217  if (no==nn) return pl;
1218  }
1219  }
1220  else if (len<0) {
1221  if (strstr(key, (char*)(pl->ldat).key.buf)!=NULL) {
1222  nn++;
1223  if (no==nn) return pl;
1224  }
1225  }
1226 
1227  pl = pl->next;
1228  }
1229  return NULL;
1230 }

References len.

◆ strstrcase_back_tList()

tList* strstrcase_back_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strstrcase_back_tList(tList* pl, const char* key, int len, int no)

char* 型変数による後方からのノードの部分文字列サーチ.大文字小文字を無視.

ポインタ pl以降のノードで,キー部の文字列または keyの文字列が相手の文字列に含まれる.
ノードの内,後ろから数えて no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー.
len0以上: key が plのキーに含まれるかどうか検査する.
len負数: plのキーが Keyに含まれるかどうか検査する.
no一致した物の中で後ろから数えて何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1497 of file tlist.c.

1498 {
1499  int nn = 0;
1500 
1501  if (pl==NULL || key==NULL) return NULL;
1502  if (no<=0) no = 1;
1503 
1504  pl = find_tList_end(pl);
1505 
1506  while (pl!=NULL) {
1507  if (len>=0) {
1508  if (strstrcase((char*)(pl->ldat).key.buf, key)!=NULL) {
1509  nn++;
1510  if (no==nn) return pl;
1511  }
1512  }
1513  else if (len<0) {
1514  if (strstrcase(key, (char*)(pl->ldat).key.buf)!=NULL) {
1515  nn++;
1516  if (no==nn) return pl;
1517  }
1518  }
1519 
1520  pl = pl->prev;
1521  }
1522  return NULL;
1523 }
char * strstrcase(const char *buf, const char *nd)
文字列 bufの中に文字列 ndがあるかどうかをチェックする.大文字小文字は区別しない.
Definition: tools.c:736

References find_tList_end(), len, and strstrcase().

Here is the call graph for this function:

◆ strstrcase_tList()

tList* strstrcase_tList ( tList pl,
const char *  key,
int  len,
int  no 
)

tList* strstrcase_tList(tList* pl, const char* key, int len, int no)

char* 型変数によるノードの部分文字列サーチ.大文字小文字を無視.

ポインタ pl以降のノードで,キー部の文字列または keyの文字列が相手の文字列に含まれるノードの内, no番目にあるのを捜し出す.

Parameters
plサーチを開始するノードへのポインタ.
keyサーチキー.
len0以上: key が plのキーに含まれるかどうか検査する.
len負数: plのキーが Keyに含まれるかどうか検査する.
no一致した物の中で何番目の物を返すか指定する.1から数える.
Returns
一致したノードへのポインタ
Return values
NULL一致したものが無い

Definition at line 1250 of file tlist.c.

1251 {
1252  int nn = 0;
1253 
1254  if (pl==NULL || key==NULL) return NULL;
1255  if (no<=0) no = 1;
1256 
1257  while (pl!=NULL) {
1258  if (len>=0) {
1259  if (strstrcase((char*)(pl->ldat).key.buf, key)!=NULL) {
1260  nn++;
1261  if (no==nn) return pl;
1262  }
1263  }
1264  else if (len<0) {
1265  if (strstrcase(key, (char*)(pl->ldat).key.buf)!=NULL) {
1266  nn++;
1267  if (no==nn) return pl;
1268  }
1269  }
1270 
1271  pl = pl->next;
1272  }
1273  return NULL;
1274 }

References len, and strstrcase().

Here is the call graph for this function:

◆ swap_tList_node()

tList* swap_tList_node ( tList pp1,
tList pp2 
)

tList* swap_tList_node(tList* pp1, tList* pp2)

pp1ノード と pp2ノード のノードデータを入れ替える.

Definition at line 342 of file tlist.c.

343 {
344  if (pp1==NULL || pp2==NULL) return NULL;
345 
346  tList_data swp = pp1->ldat;
347  pp1->ldat = pp2->ldat;
348  pp2->ldat = swp;
349 
350  return pp1;
351 /*
352  if (*pp1==NULL || *pp2==NULL) return NULL;
353 
354  tList* p1 = dup_tList_node(*pp1);
355  tList* p2 = dup_tList_node(*pp2);
356 
357  insert_tList(*pp1, p2);
358  insert_tList(*pp2, p1);
359 
360  del_tList_node(pp1);
361  del_tList_node(pp2);
362 
363  *pp1 = p2;
364  *pp2 = p1;
365 
366  return p2;
367 */
368 }

Referenced by get_dir_files().

Here is the caller graph for this function:

◆ update_tList_node()

tList* update_tList_node ( tList pp,
tList pt 
)

tList* update_tList_node(tList* pp, tList* pt)

ppを pt->keyで検索し,該当ノードがあればノードをコピーする.無ければ最後にノードを追加する(new).

Parameters
pp検索を開始するノードへのポインタ.
pt設定するノードへのポインタ.検索キーは pt->key
Returns
設定または追加したノードへのポインタ

Definition at line 609 of file tlist.c.

610 {
611  tList* pm;
612  tList_data ldat;
613 
614  if (pt==NULL) return pp;
615 
616  ldat = pp->ldat;
617  pm = update_tList_node_byBuffer(pp, ldat.id, ldat.lv, ldat.key, ldat.val, ldat.ptr, ldat.sz);
618 
619  return pm;
620 }
tList * update_tList_node_byBuffer(tList *pp, int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
key.bufで検索し,ノードがあれば設定する.無ければ最後に追加する(new).
Definition: tlist.c:703

References update_tList_node_byBuffer().

Here is the call graph for this function:

◆ update_tList_node_byBuffer()

tList* update_tList_node_byBuffer ( tList pp,
int  id,
int  lv,
Buffer  key,
Buffer  val,
void *  ptr,
int  sz 
)

tList* update_tList_node_byBuffer(tList* pp, int id, int lv, Buffer key, Buffer val, void* ptr, int sz)

ppを key.bufで検索し,該当ノードがあればノードを設定する.無ければ最後にノードを追加する(new).
それぞれのデータは複製される.

Parameters
pp検索を開始するノードへのポインタ.
idノードのID
lvノードのデータ
keyノードのキー (Buffer) 複製
valノードのデータ (Buffer) 複製
ptr汎用データへのポインタ 複製
sz*ptr のサイズ
Returns
設定または追加したノードへのポインタ

Definition at line 703 of file tlist.c.

704 {
705  tList* pm = NULL;
706 
707  if (pp==NULL || key.buf==NULL) return NULL;
708 
709  pm = strncmp_tList(pp, (char*)key.buf, 0, 1);
710  if (pm!=NULL) set_tList_node_byBuffer(pm, id, lv, key, val, ptr, sz);
711  else {
712  pm = find_tList_end(pp);
713  pm = add_tList_node_byBuffer(pm, id, lv, key, val, ptr, sz);
714  }
715 
716  return pm;
717 }
tList * strncmp_tList(tList *pl, const char *key, int len, int no)
char* 型変数によるノードのサーチ.
Definition: tlist.c:1056
void set_tList_node_byBuffer(tList *pp, int id, int lv, Buffer key, Buffer val, void *ptr, int sz)
リストのノードに値を設定する.それぞれのデータは複製されて設定される.
Definition: tlist.c:575

References add_tList_node_byBuffer(), Buffer::buf, find_tList_end(), set_tList_node_byBuffer(), and strncmp_tList().

Referenced by update_tList_node().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_tList_node_bydata()

tList* update_tList_node_bydata ( tList pp,
char *  srch,
tList_data  ldat 
)

tList* update_tList_node_bydata(tList* pp, char* srch, tList_data ldat)

ppを srchで検索し,該当ノードがあればノードを設定する.無ければ最後にノードを追加する(new).
ldat は指定されたものがそのまま使用される.

Parameters
pp検索を開始するノードへのポインタ.
srch検索キー
ldat追加するノードデータ.このデータがそのまま使用される.
Returns
設定または追加したノードへのポインタ

Definition at line 635 of file tlist.c.

636 {
637  tList* pm = NULL;
638 
639  if (pp==NULL || srch==NULL) return NULL;
640 
641  pm = strncmp_tList(pp, srch, 0, 1);
642  if (pm!=NULL) set_tList_node_bydata(pm, ldat);
643  else {
644  pm = find_tList_end(pp);
645  pm = add_tList_node_bydata(pm, ldat);
646  }
647 
648  return pm;
649 }
void set_tList_node_bydata(tList *node, tList_data dat)
リストのノードに値を設定する.
Definition: tlist.c:513

References add_tList_node_bydata(), find_tList_end(), set_tList_node_bydata(), and strncmp_tList().

Here is the call graph for this function:

◆ update_tList_node_bystr()

tList* update_tList_node_bystr ( tList pp,
int  id,
int  lv,
const char *  key,
const char *  val,
void *  ptr,
int  sz 
)

tList* update_tList_node_bystr(tList* pp, int id, int lv, const char* key, const char* val, void* ptr, int sz)

ppを keyで検索し,該当ノードがあればノードを設定する.無ければ最後にノードを追加する(new).
それぞれのデータは複製される.

Parameters
pp検索を開始するノードへのポインタ.
idノードのID
lvノードのデータ
keyノードのキー.検索キー 複製
valノードのデータ (Buffer) 複製
ptr汎用データへのポインタ 複製
sz*ptr のサイズ
Returns
設定または追加したノードへのポインタ

Definition at line 668 of file tlist.c.

669 {
670  tList* pm = NULL;
671 
672  if (pp==NULL || key==NULL) return NULL;
673 
674  pm = strncmp_tList(pp, key, 0, 1);
675  if (pm!=NULL) {
676  set_tList_node_bystr(pm, id, lv, NULL, val, ptr, sz);
677  }
678  else {
679  pm = find_tList_end(pp);
680  pm = add_tList_node_bystr(pm, id, lv, key, val, ptr, sz);
681  }
682 
683  return pm;
684 }
void set_tList_node_bystr(tList *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
文字列データからリストのノードに値を設定する.それぞれのデータは複製されて設定される.
Definition: tlist.c:536

References add_tList_node_bystr(), find_tList_end(), set_tList_node_bystr(), and strncmp_tList().

Here is the call graph for this function: