6 #define DIFF_IS_LINES_METHOD(x) (x.elem_at == methods_lines.elem_at)
16 RZ_LOG_ERROR(
"rz_diff_line_new: cannot allocate list of lines\n");
17 goto tokenize_newlines_fail;
20 size = strlen(
string);
21 for (
size_t i = 0;
i <
size; ++
i) {
22 if (
string[
i] ==
'\n') {
25 RZ_LOG_ERROR(
"rz_diff_line_new: cannot allocate line or add it to the list\n");
27 goto tokenize_newlines_fail;
36 RZ_LOG_ERROR(
"rz_diff_line_new: cannot allocate last line or add it to the list\n");
38 goto tokenize_newlines_fail;
44 tokenize_newlines_fail:
54 return strcmp(a_elem, b_elem);
static RzBinSourceLineInfo * lines(RzBinFile *bf)
RZ_API ut32 rz_diff_hash_data(RZ_NULLABLE const ut8 *buffer, ut32 size)
Calculates the hash of any given data.
static bool fake_ignore(const void *value)
void(* RzDiffMethodFree)(const void *array)
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_BORROW void * rz_list_get_n(RZ_NONNULL const RzList *list, ut32 n)
Returns the N-th element of the list.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
static int line_compare(const char *a_elem, const char *b_elem)
static const MethodsInternal methods_lines
static void line_free(RzList *array)
static void line_stringify(const char *a_elem, RzStrBuf *sb)
static ut32 line_hash(const char *elem)
static const void * line_elem_at(const RzList *array, ut32 index)
static RzList * tokenize_lines(const char *string)
const void *(* RzDiffMethodElemAt)(RZ_BORROW const void *array, ut32 index)
ut32(* RzDiffMethodElemHash)(RZ_BORROW const void *elem)
void(* RzDiffMethodStringify)(RZ_BORROW const void *elem, RZ_BORROW RzStrBuf *sb)
int(* RzDiffMethodCompare)(RZ_BORROW const void *a_elem, RZ_BORROW const void *b_elem)
void(* RzListFree)(void *ptr)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API char * rz_str_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
RZ_API const char * rz_strbuf_set(RzStrBuf *sb, const char *s)
RzDiffMethodElemAt elem_at