Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
systemd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
steam
systemd
Commits
2244a6fb
Commit
2244a6fb
authored
Apr 11, 2013
by
Zbigniew Jędrzejewski-Szmek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
util: add wrapper for realloc to avoid specyfing type
parent
2da833ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
src/libsystemd-bus/bus-match.c
src/libsystemd-bus/bus-match.c
+2
-3
src/shared/util.h
src/shared/util.h
+2
-0
No files found.
src/libsystemd-bus/bus-match.c
View file @
2244a6fb
...
...
@@ -725,7 +725,7 @@ static int parse_match(
}
}
if
(
!
greedy_realloc
((
void
**
)
&
value
,
&
value_allocated
,
j
+
2
))
{
if
(
!
GREEDY_REALLOC
(
value
,
value_allocated
,
j
+
2
))
{
r
=
-
ENOMEM
;
goto
fail
;
}
...
...
@@ -744,8 +744,7 @@ static int parse_match(
}
else
u
=
0
;
if
(
!
greedy_realloc
((
void
**
)
&
components
,
&
components_allocated
,
(
n_components
+
1
)
*
sizeof
(
struct
match_component
)))
{
if
(
!
GREEDY_REALLOC
(
components
,
components_allocated
,
n_components
+
1
))
{
r
=
-
ENOMEM
;
goto
fail
;
}
...
...
src/shared/util.h
View file @
2244a6fb
...
...
@@ -618,6 +618,8 @@ char *strextend(char **x, ...);
char
*
strrep
(
const
char
*
s
,
unsigned
n
);
void
*
greedy_realloc
(
void
**
p
,
size_t
*
allocated
,
size_t
need
);
#define GREEDY_REALLOC(array, allocated, need) \
greedy_realloc((void**) &(array), &(allocated), (sizeof *array) * (need))
static
inline
void
_reset_errno_
(
int
*
saved_errno
)
{
errno
=
*
saved_errno
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment