]> git.neil.brown.name Git - edlib.git/commitdiff
minor unalloc improvements.
authorNeilBrown <neil@brown.name>
Tue, 8 Aug 2023 22:25:32 +0000 (08:25 +1000)
committerNeilBrown <neil@brown.name>
Tue, 8 Aug 2023 22:25:32 +0000 (08:25 +1000)
unalloc can now free 'const' pointers, and strings.

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
core-misc.c
misc.h

index 30160e909639793c4406baac141a0580f8dda79c..a8539548631bedd8128bfdc844c0e246022f0df5 100644 (file)
@@ -9,6 +9,34 @@ the file.
 
 ### Triage
 
+- [ ] call, not caLl in server.py
+- [ ] lib-server received unexpected notification Close
+- [ ] should pane ->cx,cy be a struct xy??
+- [ ] revalidate_start shouldn't find cursor on line where it is known
+      not to be
+- [ ] call_render_line_to_point() never returns negative - why do we check?
+- [ ] should pane_resize() report if any change happened?
+- [ ] I think I want a "Workspaces" concept, maybe tabbed set of tile
+      collections.  I would have one of mail and one for each project
+      that I might be looking in.  I have lots of documents, but few
+      projects so this would be easier to move between.
+      "grep" and "make" etc don't care which document in a project they
+      are in.
+      "nm" already gets me to the email project quickly.  Getting back
+      is not so easy.
+      Maybe some docs could be marked "project" and so be easy to find?
+- [ ] path completion in shell command.  If cannot find look for '/'
+      following punctuation (=) and try there.
+- [ ] resolve shift-left vs shift_left distinction.
+- [ ] should zoom affect whole window, not just pane?
+- [ ] ditch cached-size for images - store in pane data instead.
+- [ ] use foreach_attr for parsing image details
+- [ ] mergeview command to show diff between "found" and "replacement".
+- [ ] mergeview command to include both found and replacement, discard
+  expected
+- [ ] ./edlib -g doesn't work
+- [ ] pop up window to show selection as QR code
+- [ ] text qrcode (qr --ascii foo) don't look right in xcb display
 - [X] factor our list-sort code.
 - [X] when cx-b and default doc name is v.long, shift gets confused
 - [X] How to run shell command in "44" window??
@@ -92,6 +120,8 @@ Requirements for a v1.0 release
 Core features
 -------------
 
+- [ ] gather memory usage stats per-pane and allow a dump
+- [ ] show doc size in doc list - include undo size?
 - [X] Discard ccache ??
 - [ ] Ensure all panes that should use "Free" properly, and find some
       what to encourage its use.
index 805a315fd76d489bdc2bf29021ab8c5e433bfc07..28a2ebe5e9435b3126166c92f1be80dd0a58b6c6 100644 (file)
@@ -363,12 +363,12 @@ void *safe do_alloc(struct mempool *pool safe, int size, int zero)
        return ret;
 }
 
-void do_unalloc(struct mempool *pool safe, void *obj, int size)
+void do_unalloc(struct mempool *pool safe, const void *obj, int size)
 {
        if (obj) {
                pool->bytes -= size;
                pool->allocations -= 1;
-               free(obj);
+               free((void*)obj);
        }
 }
 
diff --git a/misc.h b/misc.h
index 9e8ecf12ebef46bd19eed2779ab4576270703948..848f30d54566b73261e8ec9ed8b74fbb1460d0cd 100644 (file)
--- a/misc.h
+++ b/misc.h
@@ -124,7 +124,7 @@ struct mempool {
 #define MEMPOOL_DECL(_name) struct mempool mem ## _name;
 
 void *safe do_alloc(struct mempool *pool safe, int size, int zero);
-void do_unalloc(struct mempool *pool safe, void *obj, int size);
+void do_unalloc(struct mempool *pool safe, const void *obj, int size);
 
 #define alloc(var, pool)                                               \
        do { var = do_alloc(&mem##pool, sizeof((var)[0]), 1); } while (0)
@@ -138,10 +138,16 @@ void do_unalloc(struct mempool *pool safe, void *obj, int size);
 #define unalloc_buf(var, size, pool)                                   \
        do { do_unalloc(&mem##pool, var, size); (var) = NULL; } while(0)
 
+#define unalloc_str(var, pool)                                         \
+       unalloc_buf(var, strlen(var)+1, pool)
+
 #define unalloc_safe(var, pool)                                                \
        do { do_unalloc(&mem##pool, var, sizeof((var)[0])); (var)=safe_cast NULL; } while (0)
 
 #define unalloc_buf_safe(var, size, pool)                              \
        do { do_unalloc(&mem##pool, var, size); (var) = safe_cast NULL; } while(0)
 
+#define unalloc_str_safe(var, pool)                                            \
+       unalloc_buf_safe(var, strlen(var)+1, pool)
+
 #endif /* EDLIB_MISC */