mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-30 08:33:17 +03:00
tweaks: order two functions more sensibly
This commit is contained in:
parent
f26c121ca9
commit
fdeab9b4c9
20
src/utils.c
20
src/utils.c
@ -312,16 +312,6 @@ void *nrealloc(void *ptr, size_t howmuch)
|
|||||||
return r;
|
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.
|
/* Return an appropriately reallocated dest string holding a copy of src.
|
||||||
* Usage: "dest = mallocstrcpy(dest, src);". */
|
* Usage: "dest = mallocstrcpy(dest, src);". */
|
||||||
char *mallocstrcpy(char *dest, const char *src)
|
char *mallocstrcpy(char *dest, const char *src)
|
||||||
@ -334,6 +324,16 @@ char *mallocstrcpy(char *dest, const char *src)
|
|||||||
return dest;
|
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. */
|
/* Return an allocated copy of the given string. */
|
||||||
char *copy_of(const char *string)
|
char *copy_of(const char *string)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user