Changeset: 0f2d284129e3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0f2d284129e3
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_utils.c
Branch: Dec2025
Log Message:
Cleanup.
diffs (116 lines):
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -572,7 +572,6 @@ const char *ma_name(allocator *sa);
allocator_state ma_open(allocator *sa);
void *ma_realloc(allocator *sa, void *ptr, size_t sz, size_t osz);
void ma_reset(allocator *sa);
-size_t ma_size(allocator *sa);
char *ma_strconcat(allocator *sa, const char *s1, const char *s2);
char *ma_strdup(allocator *sa, const char *s);
char *ma_strndup(allocator *sa, const char *s, size_t l);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1764,7 +1764,6 @@ gdk_export void ma_destroy(allocator *sa
gdk_export char *ma_strndup(allocator *sa, const char *s, size_t l);
gdk_export char *ma_strdup(allocator *sa, const char *s);
gdk_export char *ma_strconcat(allocator *sa, const char *s1, const char *s2);
-gdk_export size_t ma_size(allocator *sa);
gdk_export const char *ma_name(allocator *sa);
gdk_export allocator_state ma_open(allocator *sa); /* open new frame of
tempory allocations */
gdk_export void ma_close(const allocator_state *); /* close temporary frame,
reset to old state */
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -2068,7 +2068,7 @@ ma_free_obj(allocator *sa, void *obj, si
}
-static void
+static inline void
ma_free_blk_memory(allocator *sa, void *blk)
{
// all blks are GDKmalloc
@@ -2127,9 +2127,6 @@ ma_use_freed_obj(allocator *sa, size_t s
return NULL;
}
-static int ma_double_num_blks(allocator *sa);
-
-
/*
* Free blocks are maintained at top level
*/
@@ -2214,7 +2211,7 @@ ma_realloc(allocator *sa, void *p, size_
return r;
}
-static void *
+static inline void *
ma_fill_in_header(void *r, size_t sz)
{
if (r) {
@@ -2426,12 +2423,6 @@ ma_strconcat(allocator *sa, const char *
return r;
}
-size_t
-ma_size(allocator *sa)
-{
- return sa->usedmem;
-}
-
const char *
ma_name(allocator *sa)
{
@@ -2452,7 +2443,6 @@ ma_open(allocator *sa)
assert(sa);
if (sa) {
assert(sa == MT_thread_getallocator());
- COND_LOCK_ALLOCATOR(sa);
st = (allocator_state) {
.nr = sa->nr,
.used = sa->used,
@@ -2462,7 +2452,6 @@ ma_open(allocator *sa)
.ma = sa,
};
sa->tmp_used += 1;
- COND_UNLOCK_ALLOCATOR(sa);
}
return st;
}
@@ -2474,19 +2463,17 @@ ma_close(const allocator_state *state)
allocator *sa = state->ma;
assert(sa);
if (sa) {
- COND_LOCK_ALLOCATOR(sa);
assert(ma_tmp_active(sa));
if (sa->tmp_used > 0) {
sa->tmp_used -= 1;
}
- // check if we can reset to the initial state
- if (state->tmp_used == 0) {
- COND_UNLOCK_ALLOCATOR(sa);
- ma_reset(sa);
- return;
- }
- assert((state->nr > 0) && (state->nr <= sa->nr));
if (state->nr != sa->nr || state->used != sa->used) {
+ // check if we can reset to the initial state
+ if (state->tmp_used == 0) {
+ ma_reset(sa);
+ return;
+ }
+ assert((state->nr > 0) && (state->nr <= sa->nr));
_ma_free_blks(sa, state->nr);
sa->nr = state->nr;
sa->used = state->used;
@@ -2494,7 +2481,6 @@ ma_close(const allocator_state *state)
sa->inuse = state->inuse;
sa->tmp_used = state->tmp_used;
}
- COND_UNLOCK_ALLOCATOR(sa);
}
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]