Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
7d3a046d
Commit
7d3a046d
authored
20 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Created convenience macros: INT_TO_BOOL() and COUNT_LIST_ITEMS().
parent
d8b90a46
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/xpdev/gen_defs.h
+12
-3
12 additions, 3 deletions
src/xpdev/gen_defs.h
with
12 additions
and
3 deletions
src/xpdev/gen_defs.h
+
12
−
3
View file @
7d3a046d
...
...
@@ -132,6 +132,9 @@ enum {
#define TRUE 1
#define FALSE 0
#endif
#ifndef INT_TO_BOOL
#define INT_TO_BOOL(x) ((x)?TRUE:FALSE)
#endif
#ifndef HANDLE
#define HANDLE void*
#endif
...
...
@@ -252,8 +255,14 @@ typedef struct {
/********************************/
/* Handy Pointer-freeing Macros */
/********************************/
#define FREE_AND_NULL(x) if(x!=NULL) { FREE(x); x=NULL; }
#define FREE_LIST_ITEMS(list,i) for(i=0;list && list[i];i++) { FREE_AND_NULL(list[i]); }
#define FREE_LIST(list,i) FREE_LIST_ITEMS(list,i) FREE_AND_NULL(list)
#define FREE_AND_NULL(x) if(x!=NULL) { FREE(x); x=NULL; }
#define FREE_LIST_ITEMS(list,i) for(i=0;list!=NULL && list[i]!=NULL;i++) \
{ FREE_AND_NULL(list[i]); }
#define FREE_LIST(list,i) FREE_LIST_ITEMS(list,i) FREE_AND_NULL(list)
/********************************/
/* Other Pointer-List Macros */
/********************************/
#define COUNT_LIST_ITEMS(list,i) for(i=0;list!=NULL && list[i]!=NULL;i++);
#endif
/* Don't add anything after this #endif statement */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment