_DBSWAP() macro is identical between lmdb.c and db3.c, consolidate to dbi.h
This commit is contained in:
parent
18a2fc0744
commit
0cbcf9b9c3
|
@ -919,19 +919,6 @@ static int db3_dbiOpen(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flag
|
|||
return rc;
|
||||
}
|
||||
|
||||
union _dbswap {
|
||||
unsigned int ui;
|
||||
unsigned char uc[4];
|
||||
};
|
||||
|
||||
#define _DBSWAP(_a) \
|
||||
\
|
||||
{ unsigned char _b, *_c = (_a).uc; \
|
||||
_b = _c[3]; _c[3] = _c[0]; _c[0] = _b; \
|
||||
_b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \
|
||||
\
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert retrieved data to index set.
|
||||
* @param dbi index database handle
|
||||
|
|
|
@ -110,6 +110,19 @@ struct dbiIndex_s {
|
|||
void * dbi_db; /*!< Backend private handle */
|
||||
};
|
||||
|
||||
union _dbswap {
|
||||
unsigned int ui;
|
||||
unsigned char uc[4];
|
||||
};
|
||||
|
||||
#define _DBSWAP(_a) \
|
||||
\
|
||||
{ unsigned char _b, *_c = (_a).uc; \
|
||||
_b = _c[3]; _c[3] = _c[0]; _c[0] = _b; \
|
||||
_b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \
|
||||
\
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -477,19 +477,6 @@ exit:
|
|||
return rc;
|
||||
}
|
||||
|
||||
union _dbswap {
|
||||
unsigned int ui;
|
||||
unsigned char uc[4];
|
||||
};
|
||||
|
||||
#define _DBSWAP(_a) \
|
||||
\
|
||||
{ unsigned char _b, *_c = (_a).uc; \
|
||||
_b = _c[3]; _c[3] = _c[0]; _c[0] = _b; \
|
||||
_b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \
|
||||
\
|
||||
}
|
||||
|
||||
/* The LMDB btree implementation needs BIGENDIAN primary keys. */
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
static int _dbibyteswapped = 1;
|
||||
|
|
Loading…
Reference in New Issue