1
1

tweaks: rename a variable and a parameter, to be more descriptive

Also, improve two comments, to describe what the functions actually do.
Этот коммит содержится в:
Benno Schulenberg 2022-02-01 11:55:31 +01:00
родитель 13caef2de0
Коммит 637a2eeb66

Просмотреть файл

@ -282,28 +282,26 @@ const char *strstrwrapper(const char *haystack, const char *needle,
return mbstrcasestr(start, needle); return mbstrcasestr(start, needle);
} }
/* This is a wrapper for the malloc() function that properly handles /* Allocate the given amount of memory and return a pointer to it. */
* things when we run out of memory. */
void *nmalloc(size_t howmuch) void *nmalloc(size_t howmuch)
{ {
void *r = malloc(howmuch); void *section = malloc(howmuch);
if (r == NULL) if (section == NULL)
die(_("Nano is out of memory!\n")); die(_("Nano is out of memory!\n"));
return r; return section;
} }
/* This is a wrapper for the realloc() function that properly handles /* Reallocate the given section of memory to have the given size. */
* things when we run out of memory. */ void *nrealloc(void *section, size_t howmuch)
void *nrealloc(void *ptr, size_t howmuch)
{ {
void *r = realloc(ptr, howmuch); section = realloc(section, howmuch);
if (r == NULL) if (section == NULL)
die(_("Nano is out of memory!\n")); die(_("Nano is out of memory!\n"));
return r; return section;
} }
/* Return an appropriately reallocated dest string holding a copy of src. /* Return an appropriately reallocated dest string holding a copy of src.