Comments (3)
I see. I suppose adding this would be fine then 😊
from list.
We have the ifndef
checks there so that you can define the macros yourself. I'm not sure what adding this would accomplish.
from list.
Ok, I'll explain in more details then:
- right now we are able to redefine that macro by providing a preprocessor definition:
gcc -DLIST_MALLOC=my_malloc -DLIST_FREE=my_free <all/list/stuff>
That is not as convenient (raise lots of warnings as well) as having a header definition, that if defined results in the following:
- Command line
gcc -DLIST_CONFIG_H=my_memory.h
// list.h
// ...
#ifdef LIST_CONFIG_H
#include LIST_CONFIG_H
#endif
#ifndef LIST_MALLOC
#define LIST_MALLOC malloc
#endif
#ifndef LIST_FREE
#define LIST_FREE free
#endif
// ...
// my_memory.h
#include "my_memory_internal.h"
#define LIST_MALLOC my_malloc
#define LIST_FREE my_free
// my_memory_internal.h
#include <stddef.h>
void *my_malloc(size_t size);
void my_free(void *mem);
So that list
library is in sync with my redefinition without complaining about implicit declaration.
from list.
Related Issues (17)
- freeing curr-val before curr HOT 4
- Default free function HOT 1
- list_t->free dox
- Add support for circular linked lists
- malloc free HOT 4
- Function pointers HOT 3
- after list_remove item is still available HOT 1
- Debian package HOT 1
- list_remove should check node to NULL HOT 3
- Error freeing items with link_remove() HOT 1
- shared library HOT 5
- Install with less generic names? HOT 4
- New release for 0.4.0 HOT 4
- Why not add LIST_FREE(node) in functions list_rpop() or list_lp()? HOT 1
- Detecting loops in linked lists HOT 1
- warning: comparison of integers of different signs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from list.