A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cosmetics
[simgrid.git]
/
src
/
xbt
/
snprintf.c
diff --git
a/src/xbt/snprintf.c
b/src/xbt/snprintf.c
index
afdc358
..
8ce12fe
100644
(file)
--- a/
src/xbt/snprintf.c
+++ b/
src/xbt/snprintf.c
@@
-1,4
+1,3
@@
-#include "gras_config.h"
/*
* snprintf.c - a portable implementation of snprintf
/*
* snprintf.c - a portable implementation of snprintf
@@
-323,7
+322,9
@@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
-#include "gras_config.h" /* to get a working stdarg.h */
+
+#include "portable.h" /* to get a working stdarg.h */
+
#include <assert.h>
#include <errno.h>
#include <assert.h>
#include <errno.h>
@@
-714,7
+715,7
@@
int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
else if (precision == 0) str_arg_l = 0;
else {
/* memchr on HP does not like n > 2^31 !!! */
else if (precision == 0) str_arg_l = 0;
else {
/* memchr on HP does not like n > 2^31 !!! */
- c
onst char *q =
memchr(str_arg, '\0',
+ c
har *q = (char *)
memchr(str_arg, '\0',
precision <= 0x7fffffff ? precision : 0x7fffffff);
str_arg_l = !q ? precision : (q-str_arg);
}
precision <= 0x7fffffff ? precision : 0x7fffffff);
str_arg_l = !q ? precision : (q-str_arg);
}
@@
-954,7
+955,7
@@
int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
int n = min_field_width - (str_arg_l+number_of_zeros_to_pad);
if (n > 0) {
if (str_l < str_m) {
int n = min_field_width - (str_arg_l+number_of_zeros_to_pad);
if (n > 0) {
if (str_l < str_m) {
-
size_
t avail = str_m-str_l;
+
in
t avail = str_m-str_l;
fast_memset(str+str_l, (zero_padding?'0':' '), (n>avail?avail:n));
}
str_l += n;
fast_memset(str+str_l, (zero_padding?'0':' '), (n>avail?avail:n));
}
str_l += n;
@@
-971,7
+972,7
@@
int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
int n = zero_padding_insertion_ind;
if (n > 0) {
if (str_l < str_m) {
int n = zero_padding_insertion_ind;
if (n > 0) {
if (str_l < str_m) {
-
size_
t avail = str_m-str_l;
+
in
t avail = str_m-str_l;
fast_memcpy(str+str_l, str_arg, (n>avail?avail:n));
}
str_l += n;
fast_memcpy(str+str_l, str_arg, (n>avail?avail:n));
}
str_l += n;
@@
-980,7
+981,7
@@
int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
n = number_of_zeros_to_pad;
if (n > 0) {
if (str_l < str_m) {
n = number_of_zeros_to_pad;
if (n > 0) {
if (str_l < str_m) {
-
size_
t avail = str_m-str_l;
+
in
t avail = str_m-str_l;
fast_memset(str+str_l, '0', (n>avail?avail:n));
}
str_l += n;
fast_memset(str+str_l, '0', (n>avail?avail:n));
}
str_l += n;
@@
-991,7
+992,7
@@
int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
{ int n = str_arg_l - zero_padding_insertion_ind;
if (n > 0) {
if (str_l < str_m) {
{ int n = str_arg_l - zero_padding_insertion_ind;
if (n > 0) {
if (str_l < str_m) {
-
size_
t avail = str_m-str_l;
+
in
t avail = str_m-str_l;
fast_memcpy(str+str_l, str_arg+zero_padding_insertion_ind,
(n>avail?avail:n));
}
fast_memcpy(str+str_l, str_arg+zero_padding_insertion_ind,
(n>avail?avail:n));
}
@@
-1003,7
+1004,7
@@
int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
int n = min_field_width - (str_arg_l+number_of_zeros_to_pad);
if (n > 0) {
if (str_l < str_m) {
int n = min_field_width - (str_arg_l+number_of_zeros_to_pad);
if (n > 0) {
if (str_l < str_m) {
-
size_
t avail = str_m-str_l;
+
in
t avail = str_m-str_l;
fast_memset(str+str_l, ' ', (n>avail?avail:n));
}
str_l += n;
fast_memset(str+str_l, ' ', (n>avail?avail:n));
}
str_l += n;