diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-04-12 11:37:22 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-04-13 08:22:44 -0300 |
commit | 34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b (patch) | |
tree | 3342c6d4a1cc54bbadb6018725410117885b3517 /src/nvim/hardcopy.c | |
parent | ba10e311bddab18e38b1b706e232f804c2da9174 (diff) | |
download | rneovim-34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b.tar.gz rneovim-34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b.tar.bz2 rneovim-34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b.zip |
memory: Add `free` wrapper and refactor project to use it
We already use wrappers for allocation, the new `xfree` function is the
equivalent for deallocation and provides a way to fully replace the malloc
implementation used by Neovim.
Diffstat (limited to 'src/nvim/hardcopy.c')
-rw-r--r-- | src/nvim/hardcopy.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index b5e7ec414c..6e9ad02b3a 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -551,7 +551,7 @@ static void prt_header(prt_settings_T *psettings, int pagenum, linenr_T lnum) p += l; } - free(tbuf); + xfree(tbuf); if (psettings->do_syntax) /* Set colors for next character. */ @@ -1539,7 +1539,7 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource) retval = (do_in_runtimepath(buffer, FALSE, prt_resource_name, resource->filename) && resource->filename[0] != NUL); - free(buffer); + xfree(buffer); return retval; } @@ -1921,7 +1921,7 @@ void mch_print_cleanup(void) */ for (i = PRT_PS_FONT_ROMAN; i <= PRT_PS_FONT_BOLDOBLIQUE; i++) { if (prt_ps_mb_font.ps_fontname[i] != NULL) - free(prt_ps_mb_font.ps_fontname[i]); + xfree(prt_ps_mb_font.ps_fontname[i]); prt_ps_mb_font.ps_fontname[i] = NULL; } } @@ -1936,7 +1936,7 @@ void mch_print_cleanup(void) prt_file_error = FALSE; } if (prt_ps_file_name != NULL) { - free(prt_ps_file_name); + xfree(prt_ps_file_name); prt_ps_file_name = NULL; } } @@ -2342,7 +2342,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) p = expand_env_save(psettings->outfile); if (p != NULL) { prt_ps_fd = mch_fopen((char *)p, WRITEBIN); - free(p); + xfree(p); } } if (prt_ps_fd == NULL) { @@ -3032,7 +3032,7 @@ int mch_print_text_out(char_u *p, size_t len) /* Need to free any translated characters */ if (prt_do_conv) - free(p); + xfree(p); prt_text_run += char_width; prt_pos_x += char_width; |