tweaks: order two functions more sensibly
Этот коммит содержится в:
родитель
f26c121ca9
Коммит
fdeab9b4c9
20
src/utils.c
20
src/utils.c
@ -312,16 +312,6 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Return an allocated copy of the first n characters of the given string. */
|
||||
char *measured_copy(const char *src, size_t n)
|
||||
{
|
||||
char *dest = charalloc(n);
|
||||
|
||||
strncpy(dest, src, n);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Return an appropriately reallocated dest string holding a copy of src.
|
||||
* Usage: "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
@ -334,6 +324,16 @@ char *mallocstrcpy(char *dest, const char *src)
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Return an allocated copy of the first n characters of the given string. */
|
||||
char *measured_copy(const char *src, size_t n)
|
||||
{
|
||||
char *dest = charalloc(n);
|
||||
|
||||
strncpy(dest, src, n);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Return an allocated copy of the given string. */
|
||||
char *copy_of(const char *string)
|
||||
{
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user