Return instead of using out parameter

This commit is contained in:
Vo Van Nghia 2020-06-18 00:24:43 +07:00
parent 8b7af2c770
commit 076f1474fa
2 changed files with 3 additions and 4 deletions

View File

@ -147,8 +147,8 @@ TF_StringStream* TF_GetLocalTempDirectories() {
return list; return list;
} }
void TF_GetTempFileName(const char* extension, char** name) { char* TF_GetTempFileName(const char* extension) {
*name = strdup(::tensorflow::io::GetTempFilename(extension).c_str()); return strdup(::tensorflow::io::GetTempFilename(extension).c_str());
} }
TF_CAPI_EXPORT extern uint64_t TF_NowNanos(void) { TF_CAPI_EXPORT extern uint64_t TF_NowNanos(void) {

View File

@ -154,8 +154,7 @@ TF_CAPI_EXPORT extern TF_StringStream* TF_GetLocalTempDirectories(void);
// Creates a temporary file name with an extension. // Creates a temporary file name with an extension.
// The caller is responsible for freeing the returned pointer. // The caller is responsible for freeing the returned pointer.
TF_CAPI_EXPORT extern void TF_GetTempFileName(const char* extension, TF_CAPI_EXPORT extern char* TF_GetTempFileName(const char* extension);
char** name);
// Returns the number of nanoseconds since the Unix epoch. // Returns the number of nanoseconds since the Unix epoch.
TF_CAPI_EXPORT extern uint64_t TF_NowNanos(void); TF_CAPI_EXPORT extern uint64_t TF_NowNanos(void);