Skip to content

Commit 9bfbb02

Browse files
committed
chore: remove a little bit of duplication
1 parent cb17661 commit 9bfbb02

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/fzf.c

+5-11
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,19 @@
1818
free((obj).data); \
1919
}
2020

21-
#define gen_slice(name, type) \
21+
#define gen_simple_slice(name, type) \
2222
typedef struct { \
2323
type *data; \
2424
size_t size; \
2525
} name##_slice_t; \
2626
static name##_slice_t slice_##name(type *input, size_t from, size_t to) { \
2727
return (name##_slice_t){.data = input + from, .size = to - from}; \
28-
} \
29-
static name##_slice_t slice_##name##_right(type *input, size_t to) { \
30-
return slice_##name(input, 0, to); \
3128
}
3229

33-
#define gen_simple_slice(name, type) \
34-
typedef struct { \
35-
type *data; \
36-
size_t size; \
37-
} name##_slice_t; \
38-
static name##_slice_t slice_##name(type *input, size_t from, size_t to) { \
39-
return (name##_slice_t){.data = input + from, .size = to - from}; \
30+
#define gen_slice(name, type) \
31+
gen_simple_slice(name, type); \
32+
static name##_slice_t slice_##name##_right(type *input, size_t to) { \
33+
return slice_##name(input, 0, to); \
4034
}
4135

4236
gen_slice(i16, int16_t);

0 commit comments

Comments
 (0)