Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libsharp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
Martin Reinecke
libsharp
Commits
5f9dc953
Commit
5f9dc953
authored
12 years ago
by
Martin Reinecke
Browse files
Options
Downloads
Patches
Plain Diff
be more paranoid with ALLOC2D
parent
a9bc412c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
c_utils/c_utils.h
+3
-3
3 additions, 3 deletions
c_utils/c_utils.h
with
3 additions
and
3 deletions
c_utils/c_utils.h
+
3
−
3
View file @
5f9dc953
...
...
@@ -113,10 +113,10 @@ void util_free_ (void *ptr);
#define ALLOC2D(ptr,type,num1,num2) \
do { \
size_t cnt_, num1_=(num1), num2_=(num2); \
ALLOC(ptr,type *,num1_); \
ALLOC(ptr[0],type,num1_*num2_); \
ALLOC(
(
ptr
)
,type *,num1_); \
ALLOC(
(
ptr
)
[0],type,num1_*num2_); \
for (cnt_=1; cnt_<num1_; ++cnt_) \
ptr[cnt_]=ptr[cnt_-1]+num2_; \
(
ptr
)
[cnt_]=
(
ptr
)
[cnt_-1]+num2_; \
} while(0)
#define DEALLOC2D(ptr) \
do { if(ptr) DEALLOC((ptr)[0]); DEALLOC(ptr); } while(0)
...
...
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