I needed to use double-linked lists in my app, there is a GList for this, but I can’t use the entire glib.
I am trying to isolate only the glist code(glist.h glist.c) to use only two-linked lists.
However, I have encountered the glist code using gslice to work with memory, I would like to avoid this. Can I replace the slice mechanism with regular calls to malloc() and free()? How is this easier to do?
Again, I need to use glist.c and glist.h separate from other code, I only need to replace the use of slices with normal functions.
If I replace the slices with normal memory management functions in the glists code, I can use glists without the rest of the library, I’m just wondering how to do it.
Well nobody is stopping you using plain malloc/free, but really at that point you may as well roll your own linked list or use existing kernel-friendly linked lists
…as suggested in the original topic
If I replace g_slice_new(GList) with malloc(sizeof(GList)) and similarly with other functions, will everything work as it should?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.