MCPcopy Create free account
hub / github.com/NetHack/NetHack / savefile

Function savefile

sys/vms/vmsunix.c:572–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570static void savefile(const char *, int, int *, char ***);
571
572static void
573savefile(const char *name, int indx, int *asize, char ***array)
574{
575 char **newarray;
576 int i, oldsize;
577
578 /* (asize - 1) guarantees that [indx + 1] will exist and be set to null */
579 while (indx >= *asize - 1) {
580 oldsize = *asize;
581 *asize += 5;
582 newarray = (char **) alloc(*asize * sizeof (char *));
583 /* poor man's realloc() */
584 for (i = 0; i < *asize; ++i)
585 newarray[i] = (i < oldsize) ? (*array)[i] : 0;
586 if (*array)
587 free((genericptr_t) *array);
588 *array = newarray;
589 }
590 (*array)[indx] = dupstr(name);
591}
592
593struct dsc {
594 unsigned short len, mbz;

Callers 1

vms_get_saved_gamesFunction · 0.85

Calls 2

dupstrFunction · 0.85
allocFunction · 0.50

Tested by

no test coverage detected