Refactor new_tempfile()

Avoid preallocating buffers on the stack, use dynamic memory allocation
instead. Also, change the semantics of new_tempfile() so that it returns
the full name of the temporary file and fix all call sites.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2014-07-21 22:56:37 +02:00
parent 21fc7a4b74
commit 66ce00153b
5 changed files with 47 additions and 45 deletions

View File

@@ -117,7 +117,6 @@
#define STATUSHEIGHT 2
#define MAX_NOTESIZ 40
#define TMPEXTSIZ 6
/* Format for appointment hours is: HH:MM */
#define HRMIN_SIZE 6
@@ -1032,7 +1031,7 @@ long now(void);
char *nowstr(void);
void print_bool_option_incolor(WINDOW *, unsigned, int, int);
const char *get_tempdir(void);
char *new_tempfile(const char *, int);
char *new_tempfile(const char *);
int check_date(unsigned, unsigned, unsigned);
int parse_date(const char *, enum datefmt, int *, int *, int *,
struct date *);