Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dkrz-sw
yaxt
Commits
304c9c5f
Commit
304c9c5f
authored
Sep 27, 2019
by
Thomas Jahns
🤸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beautify array print output.
parent
cadf6323
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
src/analyze_MPI_datatype.h
src/analyze_MPI_datatype.h
+7
-6
No files found.
src/analyze_MPI_datatype.h
View file @
304c9c5f
...
...
@@ -269,14 +269,15 @@ static void print_struct(const struct mdt_info *info, const char *line_prefix)
static
char
*
print_int_array
(
int
size
,
int
*
array
)
{
size_t
tmp_size
=
3
+
size
*
(
1
+
3
*
sizeof
(
int
))
+
1
;
size_t
tmp_size
=
3
+
(
size_t
)
size
*
(
1
+
3
*
sizeof
(
int
))
+
1
;
char
*
tmp
=
malloc
(
tmp_size
);
snprintf
(
tmp
,
tmp_size
,
"{"
);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
snprintf
(
tmp
,
tmp_size
,
"%s,%d"
,
tmp
,
array
[
i
]);
int
pos
=
sprintf
(
tmp
,
"{"
);
if
(
size
>
0
)
{
pos
+=
sprintf
(
tmp
+
pos
,
"%d"
,
array
[
0
]);
for
(
int
i
=
1
;
i
<
size
;
i
++
)
pos
+=
sprintf
(
tmp
+
pos
,
",%d"
,
array
[
i
]);
}
s
nprintf
(
tmp
,
tmp_size
,
"}"
);
s
trncat
(
tmp
+
pos
,
"}"
,
tmp_size
-
(
size_t
)
pos
);
return
tmp
;
}
...
...
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