dtsr, DtSearch: finish removing need for BYTE_SWAP define

This commit is contained in:
Jon Trulson
2021-12-21 15:45:35 -07:00
parent 3a0c2ae879
commit 931bcaa494
8 changed files with 34 additions and 83 deletions

View File

@@ -13,18 +13,6 @@ MsgCat.c: ${top_srcdir}/lib/DtSvc/DtUtil2/MsgCat.c
$(RM) MsgCat.c && ln -s ${top_srcdir}/lib/DtSvc/DtUtil2/MsgCat.c MsgCat.c
if I386
AM_CFLAGS += -DBYTE_SWAP
endif
if X86_64
AM_CFLAGS += -DBYTE_SWAP
endif
if ARM
AM_CFLAGS += -DBYTE_SWAP
endif
LDADD = ../../lib/DtSearch/libDtSearch.la
dtsrcreate_SOURCES = dtsrcreate.c MsgCat.c

View File

@@ -737,10 +737,9 @@ static void copy_new_d99 (long keyfield)
* dbrec offset.
*/
if (validation_mode) {
#ifdef BYTE_SWAP
for (swapx = 0; swapx < num_reads; swapx++)
NTOHL (word_addrs[swapx]);
#endif
/* set x to number of good addrs in this block */
if (good_addrs_left > num_reads) {
x = num_reads;
@@ -868,10 +867,9 @@ static void copy_new_d99 (long keyfield)
* dba loop for this word.
*/
if (good_addrs_this_block > 0) {
#ifdef BYTE_SWAP
for (swapx = 0; swapx < good_addrs_this_block; swapx++)
NTOHL (word_addrs_out[swapx]);
#endif
num_writes = fwrite (word_addrs_out, sizeof (DB_ADDR),
(size_t)good_addrs_this_block, fp_d99_new);
if (num_writes != good_addrs_this_block)

View File

@@ -111,7 +111,8 @@
* 2.1.5b cborodin bug. Segfault due to overflowing bitvector
* after many deletions and no mrclean.
*/
#include "SearchP.h"
#include <autotools_config.h>
#include <Dt/SearchP.h>
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
@@ -801,13 +802,11 @@ static void put_addrs_2_dtbs_addr_file (
**** num addrs in database by 1 (!?) ******/
/* (...only if prev 'overlay/compression' didn't delete all) */
#ifdef BYTE_SWAP
/* Put both arrays in 'network' byte order */
for (int32 = 0; int32 < nitems; int32++)
HTONL (addrs_array[int32]);
for (int32 = 0; int32 < num_addrs; int32++)
HTONL (word_addrs_ii[int32]);
#endif
/* Put both arrays in 'network' byte order */
for (int32 = 0; int32 < nitems; int32++)
HTONL (addrs_array[int32]);
for (int32 = 0; int32 < num_addrs; int32++)
HTONL (word_addrs_ii[int32]);
/*
* If number of new addresses greater than number of free holes,
@@ -966,11 +965,10 @@ void write_2_dtbs_addr_file (void)
(long)got_word.or_hwoffset, (long)num_reads);
DtSearchExit (98);
}
#ifdef BYTE_SWAP
for (i = 0; i < num_addrs_ii; i++)
NTOHL (word_addrs_ii[i]);
/* Now both addr arrays are in 'host' byte swap order */
#endif
/* If there are only new docs,
* this switch will prevent the checking for updates.
@@ -1116,11 +1114,11 @@ void write_new_word_2_dtbs (void)
(long)record_addr_word[int32] & 0xffL);
}
}
#ifdef BYTE_SWAP
/* Put addr array in 'network' byte order */
for (int32 = 0; int32 < num_addrs_for_word; int32++)
HTONL (record_addr_word[int32]);
#endif
/* Put addr array in 'network' byte order */
for (int32 = 0; int32 < num_addrs_for_word; int32++)
HTONL (record_addr_word[int32]);
num_writes = fwrite (record_addr_word, sizeof(DB_ADDR),
(size_t)num_addrs_for_word, dtbs_addr_fp);
if (num_writes != num_addrs_for_word)