Skip to content

Commit 2cfcae7

Browse files
committed
implicity i
1 parent 0ae617d commit 2cfcae7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

proxylab-handout/dstring.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ void string_append(string *pstr, const char *cstr)
4242
void string_appendn(string *pstr, const char *cstr, size_t cstr_len)
4343
{
4444
if (pstr->len + cstr_len + 1 <= pstr->size) {
45-
for (int i = 0; i < cstr_len; i++) {
45+
int i;
46+
for (i = 0; i < cstr_len; i++) {
4647
pstr->cstr[pstr->len+i] = cstr[i];
4748
}
4849
pstr->len += cstr_len;
@@ -51,10 +52,11 @@ void string_appendn(string *pstr, const char *cstr, size_t cstr_len)
5152
pstr->size);
5253
size_t new_size = multipler * pstr->size;
5354
char *new_str = (char *)malloc(new_size*sizeof(char));
54-
for (int i = 0; i < pstr->len; i++) {
55+
int i;
56+
for (i = 0; i < pstr->len; i++) {
5557
new_str[i] = pstr->cstr[i];
5658
}
57-
for (int i = 0; i < cstr_len; i++) {
59+
for (i = 0; i < cstr_len; i++) {
5860
new_str[pstr->len+i] = cstr[i];
5961
}
6062
pstr->len += cstr_len;

0 commit comments

Comments
 (0)