Skip to content

Commit b073211

Browse files
Luiz Fernando N. CapitulinoJunio C Hamano
authored andcommitted
ident.c: Use size_t (instead of int) to store sizes
Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 0b952a9 commit b073211

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ident.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
static char git_default_date[50];
1111

12-
static void copy_gecos(const struct passwd *w, char *name, int sz)
12+
static void copy_gecos(const struct passwd *w, char *name, size_t sz)
1313
{
1414
char *src, *dst;
15-
int len, nlen;
15+
size_t len, nlen;
1616

1717
nlen = strlen(w->pw_name);
1818

@@ -49,7 +49,7 @@ static void copy_email(const struct passwd *pw)
4949
* Make up a fake email address
5050
* (name + '@' + hostname [+ '.' + domainname])
5151
*/
52-
int len = strlen(pw->pw_name);
52+
size_t len = strlen(pw->pw_name);
5353
if (len > sizeof(git_default_email)/2)
5454
die("Your sysadmin must hate you!");
5555
memcpy(git_default_email, pw->pw_name, len);
@@ -95,9 +95,9 @@ static void setup_ident(void)
9595
datestamp(git_default_date, sizeof(git_default_date));
9696
}
9797

98-
static int add_raw(char *buf, int size, int offset, const char *str)
98+
static int add_raw(char *buf, size_t size, int offset, const char *str)
9999
{
100-
int len = strlen(str);
100+
size_t len = strlen(str);
101101
if (offset + len > size)
102102
return size;
103103
memcpy(buf + offset, str, len);
@@ -131,9 +131,9 @@ static int crud(unsigned char c)
131131
* Copy over a string to the destination, but avoid special
132132
* characters ('\n', '<' and '>') and remove crud at the end
133133
*/
134-
static int copy(char *buf, int size, int offset, const char *src)
134+
static int copy(char *buf, size_t size, int offset, const char *src)
135135
{
136-
int i, len;
136+
size_t i, len;
137137
unsigned char c;
138138

139139
/* Remove crud from the beginning.. */

0 commit comments

Comments
 (0)