Entirely forgot what I did

This commit is contained in:
Sasha Koshka 2023-11-07 17:33:53 -05:00
parent e57e93c8b6
commit 1a5c23fd35
2 changed files with 8 additions and 3 deletions

View File

@ -31,6 +31,9 @@ void XmdBufferPeek (XmdBuffer *buffer, Cardinal index, void *element);
returned and must be freed manually using XtFree() at some point. */
void *XmdBufferBreak (XmdBuffer *buffer);
/* XmdBufferLength returns the amount of elements stored in a buffer. */
Cardinal XmdBufferLength (XmdBuffer *buffer);
/* XmdBufferFree frees the buffer and any data associated with it. */
void XmdBufferFree (XmdBuffer *buffer);

View File

@ -40,6 +40,7 @@ void XmdBufferResize (XmdBuffer *buffer, Cardinal length) {
void XmdBufferFit (XmdBuffer *buffer) {
if (buffer->length > buffer->capacity) {
puts("fitting");
buffer->capacity *= XmdBUFFER_GROWTH_FACTOR;
buffer->data = XtReallocArray (
buffer->data,
@ -70,9 +71,6 @@ void XmdBufferPoke (XmdBuffer *buffer, Cardinal index, void *element) {
XmdBufferOffset(buffer, index),
element,
buffer->size);
char test;
XmdBufferPeek(buffer, index, &test);
}
void XmdBufferPeek (XmdBuffer *buffer, Cardinal index, void *element) {
@ -89,6 +87,10 @@ void *XmdBufferBreak (XmdBuffer *buffer) {
return data;
}
Cardinal XmdBufferLength (XmdBuffer *buffer) {
return buffer->length;
}
void XmdBufferFree (XmdBuffer *buffer) {
if (buffer->data != NULL) {
XtFree(buffer->data);