1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-12 19:22:41 +00:00

libdtsearch: Resolve uninitialized warnings

This commit is contained in:
Peter Howkins 2021-12-20 23:54:40 +00:00 committed by Jon Trulson
parent 320576e069
commit 182aa9fe5a
5 changed files with 27 additions and 27 deletions

View file

@ -94,7 +94,7 @@ long hilite_cleartext (int parse_type, char *stems, int stemcount)
PARG parg; PARG parg;
char * (*parser)() = usrblk.dblk->parser; char * (*parser)() = usrblk.dblk->parser;
char * (*stemmer)() = usrblk.dblk->stemmer; char * (*stemmer)() = usrblk.dblk->stemmer;
DtSrHitword *hitwords; DtSrHitword *hitwords = NULL;
size_t hitwords_size = 0; size_t hitwords_size = 0;
long hitwcount = 0; long hitwcount = 0;
long offset; long offset;
@ -158,10 +158,10 @@ long hilite_cleartext (int parse_type, char *stems, int stemcount)
hitwords = realloc (hitwords, hitwords = realloc (hitwords,
hitwords_size * sizeof(DtSrHitword) + 16); hitwords_size * sizeof(DtSrHitword) + 16);
} }
if (!hitwords) { }
fputs (PROGNAME"091 Out of Memory!\n", aa_stderr); if (!hitwords) {
DtSearchExit (91); fputs (PROGNAME"091 Out of Memory!\n", aa_stderr);
} DtSearchExit (91);
} }
hitwords[hitwcount].offset = offset; hitwords[hitwcount].offset = offset;
hitwords[hitwcount].length = wordlen; hitwords[hitwcount].length = wordlen;

View file

@ -84,8 +84,8 @@ int dbn /* Database number */
char *orec; /* ptr to current owner record contents in cache */ char *orec; /* ptr to current owner record contents in cache */
char *mrec; /* ptr to current member record contents in cache */ char *mrec; /* ptr to current member record contents in cache */
char *nrec; /* ptr to next member record contents in cache */ char *nrec; /* ptr to next member record contents in cache */
DB_ADDR mdba; /* db address of current member record */ DB_ADDR mdba = NULL; /* db address of current member record */
DB_ADDR ndba; /* db address of next member record */ DB_ADDR ndba = NULL; /* db address of next member record */
INT ordering; /* set order control variable */ INT ordering; /* set order control variable */
int stat, compare; /* status code & sort comparison result */ int stat, compare; /* status code & sort comparison result */
SET_ENTRY *set_ptr; SET_ENTRY *set_ptr;

View file

@ -811,10 +811,10 @@ LOOKUP_ENTRY * *xlu_ptr /* pointer to lookup table slot for found page*/
{ {
LOOKUP_ENTRY *lookup; /* = db_lookup or ix_lookup */ LOOKUP_ENTRY *lookup; /* = db_lookup or ix_lookup */
int pgtab_sz; /* = db_pgtab_sz or ix_pgtab_sz */ int pgtab_sz; /* = db_pgtab_sz or ix_pgtab_sz */
long cmp; long cmp = 0;
int cnt; int cnt;
int lu_slot, l, u; int lu_slot = 0, l, u;
LOOKUP_ENTRY *lu_ptr, *replu_ptr; LOOKUP_ENTRY *lu_ptr = NULL, *replu_ptr;
PAGE_ENTRY *pg_ptr; PAGE_ENTRY *pg_ptr;
int *lru_ptr; int *lru_ptr;
int pg_slot; int pg_slot;

View file

@ -55,7 +55,7 @@
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
db_VISTA Key File/Field Manipulation Functions db_VISTA Key File/Field Manipulation Functions
---------------------------------------------- ----------------------------------------------
An implementation of the B-tree indexing method described in An implementation of the B-tree indexing method described in
"Sorting and Searching: The Art of Computer Programming, Vol III", "Sorting and Searching: The Art of Computer Programming, Vol III",
Knuth, Donald E., Addison-Wesley, 1975. pp 473-480. Knuth, Donald E., Addison-Wesley, 1975. pp 473-480.
@ -164,12 +164,12 @@ key_open(void)
} }
if ( no_of_keys ) { if ( no_of_keys ) {
key_info = key_info =
/* Macro references must be on one line for some compilers */ /* Macro references must be on one line for some compilers */
(KEY_INFO *) (KEY_INFO *)
ALLOC(&db_global.Key_info, no_of_keys*sizeof(KEY_INFO), "key_info"); ALLOC(&db_global.Key_info, no_of_keys*sizeof(KEY_INFO), "key_info");
if ( ! key_info ) if ( ! key_info )
return( dberr(S_NOMEMORY) ); return( dberr(S_NOMEMORY) );
for (i = 0, fld_ptr = &field_table[old_size_fd]; for (i = 0, fld_ptr = &field_table[old_size_fd];
i < size_fd; ++i, ++fld_ptr) { i < size_fd; ++i, ++fld_ptr) {
if ( fld_ptr->fd_key != NOKEY ) { if ( fld_ptr->fd_key != NOKEY ) {
ki_ptr = &key_info[fld_ptr->fd_keyno]; ki_ptr = &key_info[fld_ptr->fd_keyno];
@ -180,7 +180,7 @@ key_open(void)
ki_ptr->dba = NULL_DBA; ki_ptr->dba = NULL_DBA;
file_ptr = &file_table[fld_ptr->fd_keyfile]; file_ptr = &file_table[fld_ptr->fd_keyfile];
ki_ptr->keyval = ki_ptr->keyval =
/* Macro references must be on one line for some compilers */ /* Macro references must be on one line for some compilers */
ALLOC(&ki_ptr->Keyval, file_ptr->ft_slsize, db_avname); ALLOC(&ki_ptr->Keyval, file_ptr->ft_slsize, db_avname);
if ( ! ki_ptr->keyval ) if ( ! ki_ptr->keyval )
return( dberr(S_NOMEMORY) ); return( dberr(S_NOMEMORY) );
@ -258,7 +258,7 @@ int field /* field number to be processed */
/* Reset key_info last status to reposition keys on file "fno" /* Reset key_info last status to reposition keys on file "fno"
*/ */
int int
key_reset(FILE_NO fno) key_reset(FILE_NO fno)
@ -267,7 +267,7 @@ key_reset(FILE_NO fno)
KEY_INFO *ki_ptr; KEY_INFO *ki_ptr;
for (i = 0, ki_ptr = key_info; i < no_of_keys; ++i, ++ki_ptr) { for (i = 0, ki_ptr = key_info; i < no_of_keys; ++i, ++ki_ptr) {
if (((fno == size_ft) || (ki_ptr->keyfile == fno)) && if (((fno == size_ft) || (ki_ptr->keyfile == fno)) &&
((ki_ptr->lstat == KEYFOUND) || (ki_ptr->lstat == KEYNOTFOUND))) ((ki_ptr->lstat == KEYFOUND) || (ki_ptr->lstat == KEYNOTFOUND)))
ki_ptr->lstat = KEYREPOS; ki_ptr->lstat = KEYREPOS;
} }
@ -363,7 +363,7 @@ DB_ADDR *dba /* database address of located key */
/* return database address for d_keyfind */ /* return database address for d_keyfind */
if ( *dba == NULL_DBA ) if ( *dba == NULL_DBA )
bytecpy(dba, &curkey->dba, sizeof(DB_ADDR)); bytecpy(dba, &curkey->dba, sizeof(DB_ADDR));
return( db_status ); return( db_status );
} }
@ -380,8 +380,8 @@ int *slot_offset, /* slot position offset */
F_ADDR *child /* child ptr of located key */ F_ADDR *child /* child ptr of located key */
) )
{ {
int cmp, i, l, u, slot_pos; int cmp = 0, i = 0, l, u, slot_pos = 0;
char *node_slot_ptr; char *node_slot_ptr = NULL;
/* perform binary search on node */ /* perform binary search on node */
l = 0; l = 0;
@ -432,7 +432,7 @@ KEY_SLOT *slot, /* pointer to key slot to be compared */
DB_ADDR *dba /* database address included in comparison if not null */ DB_ADDR *dba /* database address included in comparison if not null */
) )
{ {
/* /*
returns < 0 if key_val < slot returns < 0 if key_val < slot
> 0 if key_val > slot > 0 if key_val > slot
= 0 if key_val == slot = 0 if key_val == slot
@ -529,7 +529,7 @@ DB_ADDR *dba /* db address of scanned record */
node_slot_ptr = &node->slots[np_ptr->slot*slot_len]; node_slot_ptr = &node->slots[np_ptr->slot*slot_len];
} }
bytecpy(&child, node_slot_ptr, sizeof(F_ADDR)); bytecpy(&child, node_slot_ptr, sizeof(F_ADDR));
} while ( child != NULL_NODE ); } while ( child != NULL_NODE );
if (np_ptr->slot == node->used_slots) { if (np_ptr->slot == node->used_slots) {
--np_ptr->slot; --np_ptr->slot;
@ -686,9 +686,9 @@ DB_ADDR dba /* record's database address */
} }
db_status = stat; db_status = stat;
} }
else if ( db_status == S_OKAY ) else if ( db_status == S_OKAY )
dberr(S_SYSERR); dberr(S_SYSERR);
return( db_status ); return( db_status );
} }
@ -925,7 +925,7 @@ static int delete(void)
r_node_slot_ptr = &r_node->slots[sizeof(F_ADDR)]; r_node_slot_ptr = &r_node->slots[sizeof(F_ADDR)];
bytecpy(node_slot_ptr, r_node_slot_ptr, slot_len - sizeof(F_ADDR)); bytecpy(node_slot_ptr, r_node_slot_ptr, slot_len - sizeof(F_ADDR));
dio_touch(pg); dio_touch(pg);
/* set up to delete key from leaf */ /* set up to delete key from leaf */
/* (this is more efficient than a recursive call) */ /* (this is more efficient than a recursive call) */
slot_pos = 0; slot_pos = 0;
@ -1158,7 +1158,7 @@ d_keyread(char *key_val)
if ( cfld_ptr->fd_type == COMKEY ) { if ( cfld_ptr->fd_type == COMKEY ) {
/* copy compound key fields */ /* copy compound key fields */
for (kt_lc = size_kt - cfld_ptr->fd_ptr, for (kt_lc = size_kt - cfld_ptr->fd_ptr,
key_ptr = &key_table[cfld_ptr->fd_ptr]; key_ptr = &key_table[cfld_ptr->fd_ptr];
(--kt_lc >= 0) && (key_ptr->kt_key == fldno); ++key_ptr) { (--kt_lc >= 0) && (key_ptr->kt_key == fldno); ++key_ptr) {
fld_ptr = &field_table[key_ptr->kt_field]; fld_ptr = &field_table[key_ptr->kt_field];
fptr = key_type.ks.data + key_ptr->kt_ptr; fptr = key_type.ks.data + key_ptr->kt_ptr;

View file

@ -303,7 +303,7 @@ DB_ADDR *db_addr
char *fptr; char *fptr;
const char *tfptr; const char *tfptr;
int s, i, strfld; int s, i, strfld;
FIELD_ENTRY *sfld_ptr; FIELD_ENTRY *sfld_ptr = NULL;
SORT_ENTRY *srt_ptr; SORT_ENTRY *srt_ptr;
DB_ADDR *co_ptr, *cm_ptr; DB_ADDR *co_ptr, *cm_ptr;
@ -402,7 +402,7 @@ DB_ADDR *db_addr
} }
} }
} }
if ( strfld >= 0 ) { if ( strfld >= 0 && sfld_ptr) {
/* insert the new struct key */ /* insert the new struct key */
if ( key_insert( strfld, rec + sfld_ptr->fd_ptr, dba ) != S_OKAY ) if ( key_insert( strfld, rec + sfld_ptr->fd_ptr, dba ) != S_OKAY )
return( db_status ); return( db_status );