Use Rizin specific macros instead of the ones from SDB

This commit is contained in:
Riccardo Schirone 2022-07-04 14:01:30 +02:00 committed by Riccardo Schirone
parent 1331474286
commit 6c665c6098
11 changed files with 18 additions and 11 deletions

View file

@ -176,7 +176,7 @@ static int v850_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8
ut16 word1 = 0, word2 = 0;
struct v850_cmd cmd;
if (len < 1 || (len > 0 && !memcmp(buf, "\xff\xff\xff\xff\xff\xff", R_MIN(len, 6)))) {
if (len < 1 || (len > 0 && !memcmp(buf, "\xff\xff\xff\xff\xff\xff", RZ_MIN(len, 6)))) {
return -1;
}

View file

@ -487,7 +487,7 @@ static int __cons_readchar_w32(ut32 usec) {
char *tmp = rz_utf16_to_utf8_l(&irInBuf.Event.KeyEvent.uChar.UnicodeChar, 1);
if (tmp) {
int len = strlen(tmp);
memcpy(&ch, tmp, R_MIN(len, sizeof(ch)));
memcpy(&ch, tmp, RZ_MIN(len, sizeof(ch)));
free(tmp);
}
} else {

View file

@ -3798,7 +3798,7 @@ RZ_API bool rz_agraph_del_node(const RzAGraph *g, const char *title) {
return true;
}
static bool user_node_cb(struct g_cb *user, const void *k UNUSED, const void *v) {
static bool user_node_cb(struct g_cb *user, RZ_UNUSED const void *k, const void *v) {
RzANodeCallback cb = user->node_cb;
void *user_data = user->data;
RzANode *n = (RzANode *)v;
@ -3808,7 +3808,7 @@ static bool user_node_cb(struct g_cb *user, const void *k UNUSED, const void *v)
return true;
}
static bool user_edge_cb(struct g_cb *user, const void *k UNUSED, const void *v) {
static bool user_edge_cb(struct g_cb *user, RZ_UNUSED const void *k, const void *v) {
RAEdgeCallback cb = user->edge_cb;
RzAGraph *g = user->graph;
void *user_data = user->data;

View file

@ -182,13 +182,13 @@ static inline void diff_unified_lines_hl(RzDiff *diff, RzDiffOp *op, RzStrBuf *s
if (len && len_b && (p[0] == p_b[0] || p[len - 1] == p_b[len_b - 1])) {
// Get left bound.
st32 left = 0;
for (; left < R_MIN(len, len_b) && p[left] == p_b[left]; left++)
for (; left < RZ_MIN(len, len_b) && p[left] == p_b[left]; left++)
;
char_bounds[bounds_idx * 2] = left;
// Get right bound (offset). "- left" chops off
// the left portion that has already matched.
st32 right = 0;
for (; right < R_MIN(len, len_b) - left && p[len - 1 - right] == p_b[len_b - 1 - right];
for (; right < RZ_MIN(len, len_b) - left && p[len - 1 - right] == p_b[len_b - 1 - right];
right++)
;
char_bounds[bounds_idx * 2 + 1] = right;

View file

@ -10,6 +10,9 @@
#include <stddef.h>
#include <assert.h>
#include <errno.h>
#if HAVE_HEADER_INTTYPES_H
#include <inttypes.h>
#endif
// TODO: fix this to make it crosscompile-friendly: RZ_SYS_OSTYPE ?
/* operating system */
@ -345,7 +348,7 @@ static inline void *rz_new_copy(int size, void *data) {
#if !(defined(__GNUC__) && __GNUC__ < 5) || defined(__clang__)
#define rz_offsetof(type, member) offsetof(type, member)
#else
#if __SDB_WINDOWS__
#if __WINDOWS__
#define rz_offsetof(type, member) ((unsigned long)(ut64) & ((type *)0)->member)
#else
#define rz_offsetof(type, member) ((unsigned long)&((type *)0)->member)

View file

@ -54,6 +54,7 @@
#define HAVE_HEADER_SYS_SHM_H @HAVE_HEADER_SYS_SHM_H@
#define HAVE_HEADER_SYS_IPC_H @HAVE_HEADER_SYS_IPC_H@
#define HAVE_HEADER_SYS_MMAN_H @HAVE_HEADER_SYS_MMAN_H@
#define HAVE_HEADER_INTTYPES_H @HAVE_HEADER_INTTYPES_H@
#define RZ_IS_PORTABLE @IS_PORTABLE@
// clang-format on

View file

@ -4,7 +4,7 @@
#include <rz_reg.h>
#include <rz_util.h>
#if __SDB_WINDOWS__
#if __WINDOWS__
#define CASTLDBL (double)
#else
#define CASTLDBL

View file

@ -485,6 +485,7 @@ foreach item : [
['sys/shm.h', '', []],
['sys/ipc.h', '', []],
['sys/mman.h', '', []],
['inttypes.h', '', []],
]
hdr = item[0]
ok = cc.has_header(hdr, prefix: item[1], dependencies: item[2])

View file

@ -236,7 +236,7 @@ bitmap_unset(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit)
size_t goff;
bitmap_t *gp;
bitmap_t g;
UNUSED bool propagate;
RZ_UNUSED bool propagate;
assert(bit < binfo->nbits);
assert(bitmap_get(bitmap, binfo, bit));

View file

@ -152,7 +152,7 @@ hash_x86_32(const void *key, int len, uint32_t seed)
return (h1);
}
UNUSED JEMALLOC_INLINE void
RZ_UNUSED JEMALLOC_INLINE void
hash_x86_128(const void *key, const int len, uint32_t seed,
uint64_t rz_out[2])
{
@ -254,7 +254,7 @@ hash_x86_128(const void *key, const int len, uint32_t seed,
rz_out[1] = (((uint64_t) h4) << 32) | h3;
}
UNUSED JEMALLOC_INLINE void
RZ_UNUSED JEMALLOC_INLINE void
hash_x64_128(const void *key, const int len, const uint32_t seed,
uint64_t rz_out[2])
{

View file

@ -10,6 +10,8 @@
#ifndef _MINUNIT_H_
#define _MINUNIT_H_
#include <rz_types.h>
#if __WINDOWS__
#define TRED
#define TGREEN