Skip to content

Commit 6d9281f

Browse files
fix: Update buffer info structs to use flags and atomic operations
Co-Authored-By: Matt Wong <[email protected]>
1 parent 0de1bc6 commit 6d9281f

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

app/sheet/handlers.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,7 @@ struct zsvsheet_buffer_info_internal zsvsheet_buffer_info_internal(zsvsheet_buff
177177
struct zsvsheet_ui_buffer *b = h;
178178

179179
pthread_mutex_lock(&b->mutex);
180-
info.index_started = index_started(b);
181-
info.index_ready = index_ready(b);
182-
info.write_in_progress = write_in_progress(b);
183-
info.write_done = write_done(b);
180+
info.flags = b->flags;
184181
info.dimensions = b->dimensions;
185182
pthread_mutex_unlock(&b->mutex);
186183
}

app/sheet/handlers_internal.h

+15-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,21 @@ enum zsvsheet_status zsvsheet_push_transformation(zsvsheet_proc_context_t ctx,
122122
struct zsvsheet_buffer_transformation_opts opts);
123123
#endif
124124

125-
struct zsvsheet_buffer_data zsvsheet_buffer_info(zsvsheet_buffer_t buff);
125+
/**
126+
* Get information about the buffer's flags and state
127+
*/
128+
struct zsvsheet_buffer_info {
129+
char has_row_num;
130+
size_t rownum_col_offset;
131+
};
132+
133+
/**
134+
* Get internal information about the buffer's state
135+
*/
136+
struct zsvsheet_buffer_info_internal {
137+
struct zsvsheet_flags flags;
138+
struct zsvsheet_dimensions dimensions;
139+
};
126140

127141
/** cell formatting **/
128142
zsvsheet_cell_attr_t zsvsheet_cell_profile_attrs(enum zsvsheet_cell_profile_t);

0 commit comments

Comments
 (0)