summaryrefslogtreecommitdiffstats
path: root/src/defs.h
diff options
context:
space:
mode:
authorGravatar Gediminas Jakutis <gediminas@varciai.lt> 2021-03-03 14:57:28 +0200
committerGravatar Gediminas Jakutis <gediminas@varciai.lt> 2021-03-03 14:57:28 +0200
commit068e3e6c5a74702c3e7db0e37b243f522c433a7f (patch)
treef786f107ff5759084e3c1f76f5734cad2084fdd2 /src/defs.h
parentb3072e146b4edd4a2422cee758aa341b0638491d (diff)
downloadalgos-ld1-068e3e6c5a74702c3e7db0e37b243f522c433a7f.tar.gz
algos-ld1-068e3e6c5a74702c3e7db0e37b243f522c433a7f.tar.bz2
algos-ld1-068e3e6c5a74702c3e7db0e37b243f522c433a7f.zip
straight up code refactor.
Signed-off-by: Gediminas Jakutis <gediminas@varciai.lt>
Diffstat (limited to 'src/defs.h')
-rw-r--r--src/defs.h14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/defs.h b/src/defs.h
index 5d632c3..0d543d7 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -49,9 +49,6 @@
# endif
#endif
-#define get(in) (in->settings->access == cached ? in->get_next_element_cache(in) : in->get_next_element_direct(in))
-#define put(in, data) (in->settings->access == cached ? in->place_next_element_cache(in, data) : in->place_next_element_direct(in, data))
-
union nextoff {
struct entry_l *next;
void *nextaddr;
@@ -96,7 +93,7 @@ enum streamtype {
stream_invalid,
stream_in,
stream_out,
- stream_outlite,
+ stream_lite,
stream_cache,
stream_randread
};
@@ -110,12 +107,11 @@ struct stream {
struct entry_l *cnode; /* "current" node */
union cachewrap;
struct settings *settings;
- struct entry_l *(*get_next_element_direct)(struct stream * const);
- struct entry_l *(*get_next_element_cache)(struct stream * const);
- int (*place_next_element_direct)(struct stream * const, struct entry_l const * const);
- int (*place_next_element_cache)(struct stream * const, struct entry_l const * const);
+ struct entry_l *(*get)(struct stream * const);
+ int (*put)(struct stream * const, struct entry_l const * const);
int (*split)(struct stream * const, struct stream * const, struct stream * const);
- int (*rewind)(struct stream * const);
+ int (*rewind)(struct stream * restrict const);
+ int (*copy)(struct stream * restrict const, struct stream * restrict const);
};
struct settings {