yasm_fopen_include: Allow oname to be NULL. Also set oname to NULL if NULL

is returned.

svn path=/trunk/yasm/; revision=1670
0.6.0
Peter Johnson 18 years ago
parent c81b221152
commit 5f1412ee6b
  1. 12
      libyasm/file.c
  2. 9
      libyasm/file.h

@ -422,7 +422,10 @@ yasm_fopen_include(const char *iname, const char *from, const char *mode,
combine = yasm__combpath(from, iname);
f = fopen(combine, mode);
if (f) {
*oname = combine;
if (oname)
*oname = combine;
else
yasm_xfree(combine);
return f;
}
yasm_xfree(combine);
@ -432,12 +435,17 @@ yasm_fopen_include(const char *iname, const char *from, const char *mode,
combine = yasm__combpath(np->path, iname);
f = fopen(combine, mode);
if (f) {
*oname = combine;
if (oname)
*oname = combine;
else
yasm_xfree(combine);
return f;
}
yasm_xfree(combine);
}
if (oname)
*oname = NULL;
return NULL;
}

@ -182,12 +182,13 @@ char *yasm__combpath_win(const char *from, const char *to);
* \param iname file to include
* \param from file doing the including
* \param mode fopen mode string
* \param oname full pathname of included file (may be relative)
* \param oname full pathname of included file (may be relative). NULL
* may be passed if this is unwanted.
* \return fopen'ed include file, or NULL if not found.
*/
/*@null@*/ FILE *yasm_fopen_include(const char *iname, const char *from,
const char *mode,
/*@out@*/ /*@only@*/ char **oname);
/*@null@*/ FILE *yasm_fopen_include
(const char *iname, const char *from, const char *mode,
/*@null@*/ /*@out@*/ /*@only@*/ char **oname);
/** Delete any stored include paths added by yasm_add_include_path().
*/

Loading…
Cancel
Save