Skip to content

Commit 29b04e9

Browse files
committed
Replace useless strncpy to avoid compilation warning
As suggested by Johannes Altmanninger. Closes #1036
1 parent 32150b6 commit 29b04e9

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/io.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ encoding_open(const char *fromcode)
4949
}
5050

5151
encoding = calloc(1, sizeof(*encoding) + len);
52-
strncpy(encoding->fromcode, fromcode, len);
52+
strcpy(encoding->fromcode, fromcode);
5353
encoding->cd = iconv_open(ENCODING_UTF8, fromcode);
5454
if (encoding->cd == ICONV_NONE) {
5555
free(encoding);

src/parse.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ get_path(const char *path)
262262
free(entry);
263263
return NULL;
264264
}
265-
strncpy(entry->path, path, strlen(path));
265+
strcpy(entry->path, path);
266266
}
267267

268268
return entry->path;

src/refs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ refs_open(struct view *view, enum open_flags flags)
207207
if (!ref)
208208
return ERROR_OUT_OF_MEMORY;
209209

210-
strncpy(ref->name, name, name_length);
210+
strcpy(ref->name, name);
211211
refs_all = ref;
212212
}
213213

src/tree.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ tree_entry(struct view *view, enum line_type type, const char *path,
129129
if (!line)
130130
return NULL;
131131

132-
strncpy(entry->name, path, strlen(path));
132+
strcpy(entry->name, path);
133133
if (mode)
134134
entry->mode = strtoul(mode, NULL, 8);
135135
if (id)

0 commit comments

Comments
 (0)