Lines Matching full:if
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 #if !defined(DEBUG) && !defined(NDEBUG)
67 #if (_BYTE_ORDER == _LITTLE_ENDIAN)
115 if ((flags & O_ACCMODE) == O_WRONLY) {
120 if (!(hashp = (HTAB *)calloc(1, sizeof(HTAB))))
125 * Even if user wants write only, we need to be able to read
133 if (!file || (flags & O_TRUNC) ||
139 if (errno == ENOENT)
143 if (file) {
144 if ((hashp->fp = open(file, flags, mode)) == -1)
147 /* if the .db file is empty, and we had permission to create
149 if ((flags & O_CREAT) &&
161 if (new_table) {
162 if (!(hashp = init_hash(hashp, file, (HASHINFO *)info)))
166 if (info && info->hash)
172 #if (_BYTE_ORDER == _LITTLE_ENDIAN)
175 if (hdrsize == -1)
177 if (hdrsize != sizeof(HASHHDR))
180 if (hashp->MAGIC != HASHMAGIC)
183 if (hashp->HASH_VERSION != HASHVERSION &&
186 if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
189 if (hashp->BSIZE > INT_MAX)
199 if (alloc_segs(hashp, nsegs))
201 * If alloc_segs fails, table will have been destroyed
215 if (info && info->cachesize)
223 if (!(dbp = (DB *)malloc(sizeof(DB)))) {
264 if (hashp != NULL)
279 if (!dbp)
293 if (!dbp)
297 if (hashp->fp == -1) {
331 if (file != NULL) {
333 if (stat64(file, &statbuf))
335 if (stat(file, &statbuf))
342 if (info) {
343 if (info->bsize) {
347 if (hashp->BSIZE > MAX_BSIZE) {
352 if (info->ffactor)
354 if (info->hash)
356 if (info->nelem)
358 if (info->lorder) {
359 if (info->lorder != DB_BIG_ENDIAN &&
367 /* init_htab should destroy the table and set errno if it fails */
368 if (init_htab(hashp, nelem))
401 if (__ibitmap(hashp, OADDR_OF(l2, 1), l2 + 1, 0))
412 if (nsegs > hashp->DSIZE)
420 * Flushes any changes to the file if necessary and destroys the hashp
445 * Call on buffer manager to free buffers, and if required,
448 if (__buf_free(hashp, 1, hashp->save_file))
450 if (hashp->dir) {
457 if (flush_meta(hashp) && !save_errno)
461 if (hashp->mapp[i])
464 if (hashp->fp != -1)
469 if (save_errno) {
487 if (flags != 0) {
492 if (!dbp)
496 if (!hashp->save_file)
498 if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
513 #if (_BYTE_ORDER == _LITTLE_ENDIAN)
518 if (!hashp->save_file)
526 #if (_BYTE_ORDER == _LITTLE_ENDIAN)
530 if ((lseek(fp, (off_t)0, SEEK_SET) == -1) ||
534 if (wsize != sizeof(HASHHDR)) {
540 if (hashp->mapp[i])
541 if (__put_page(hashp, (char *)hashp->mapp[i],
565 if (flag) {
581 if (flag && flag != R_NOOVERWRITE) {
586 if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
602 if (flag && flag != R_CURSOR) {
606 if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
637 if (!rbufp)
644 if (bp[1] >= REAL_KEY) {
646 if (size == off - (int) *bp &&
655 } else if (bp[1] == OVFLPAGE) {
657 if (!rbufp) {
666 } else if (bp[1] < REAL_KEY) {
667 if ((ndx =
670 if (ndx == -2) {
672 if (!(pageno =
679 if (!rbufp) {
698 if (__addel(hashp, rbufp, key, val)) {
719 if (bp[ndx + 1] < REAL_KEY) {
720 if (__big_return(hashp, rbufp, ndx, val, 0))
728 if ((__delpair(hashp, rbufp, ndx)) ||
735 if (__delpair(hashp, rbufp, ndx))
757 if (flag && flag != R_FIRST && flag != R_NEXT) {
764 if ((hashp->cbucket < 0) || (flag == R_FIRST)) {
771 if (!(bufp = hashp->cpage)) {
776 if (!bufp)
780 if (bp[0])
784 if (hashp->cbucket > hashp->MAX_BUCKET) {
797 if (!bufp)
802 if (!bp[0]) {
808 if (bp[ndx + 1] < REAL_KEY) {
809 if (__big_keydata(hashp, bufp, key, data, 1))
817 if (ndx > bp[0]) {
848 /* Check if we need a new segment */
849 if (new_segnum >= hashp->nsegs) {
850 /* Check if we need to expand directory */
851 if (new_segnum >= hashp->DSIZE) {
854 if (!hash_realloc(&hashp->dir, dirsize, dirsize << 1))
859 if (seg == NULL)
866 * If the split point is increasing (MAX_BUCKET's log base 2
871 if (spare_ndx > hashp->OVFL_POINT) {
876 if (new_bucket > hashp->HIGH_MASK) {
886 * If realloc guarantees that the pointer is not destroyed if the realloc
894 if ( (p = malloc(newsize)) ) {
912 if (bucket > hashp->MAX_BUCKET)
930 if ((hashp->dir =
938 if ((store =
951 #if (_BYTE_ORDER == _LITTLE_ENDIAN)