diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-05-30 14:12:16 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-05-30 14:12:16 -0700 |
| commit | b2338c1a6d1e57f01396a8e77c65734cb2f0ae17 (patch) | |
| tree | f7ca90cff42143f8f4e74693b0d739b8621d9efc | |
| parent | d11d2acb55d6c5cdc02281346c394aef42a4fbc1 (diff) | |
| download | nng-b2338c1a6d1e57f01396a8e77c65734cb2f0ae17.tar.gz nng-b2338c1a6d1e57f01396a8e77c65734cb2f0ae17.tar.bz2 nng-b2338c1a6d1e57f01396a8e77c65734cb2f0ae17.zip | |
fixes #499 Eliminate the unused nni_plat_home_dir...
| -rw-r--r-- | src/core/platform.h | 6 | ||||
| -rw-r--r-- | src/platform/posix/posix_file.c | 13 | ||||
| -rw-r--r-- | src/platform/windows/win_file.c | 19 | ||||
| -rw-r--r-- | tests/files.c | 4 |
4 files changed, 1 insertions, 41 deletions
diff --git a/src/core/platform.h b/src/core/platform.h index bdc74349..07bfc14c 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -523,12 +523,6 @@ extern int nni_plat_dir_remove(const char *); // The result should be freed with nni_strfree(). extern char *nni_plat_temp_dir(void); -// nni_plat_home_dir returns the "home" directory for the user running the -// application. This is a convenient place to store preferences, etc. -// Applications should append an application specific directory name. -// The result should be freed with nni_strfree(). -extern char *nni_plat_home_dir(void); - // nni_plat_join_dir joins to path components to make a path name. // For example. on UNIX systems nni_plat_join_dir("/tmp", "a") returns // "/tmp/a". The pathname returned should be freed with nni_strfree(). diff --git a/src/platform/posix/posix_file.c b/src/platform/posix/posix_file.c index b1da3cd5..b21c0509 100644 --- a/src/platform/posix/posix_file.c +++ b/src/platform/posix/posix_file.c @@ -317,19 +317,6 @@ nni_plat_temp_dir(void) } char * -nni_plat_home_dir(void) -{ - char *home; - - // POSIX says that $HOME is *REQUIRED*. We could look in - // getpwuid, but realistically this is simply not required. - if ((home = getenv("HOME")) != NULL) { - return (nni_strdup(home)); - } - return (NULL); -} - -char * nni_plat_join_dir(const char *prefix, const char *suffix) { char * newdir; diff --git a/src/platform/windows/win_file.c b/src/platform/windows/win_file.c index 515647e0..3b6461a6 100644 --- a/src/platform/windows/win_file.c +++ b/src/platform/windows/win_file.c @@ -273,23 +273,6 @@ nni_plat_temp_dir(void) return (nni_strdup(path)); } -char * -nni_plat_home_dir(void) -{ - char *homedrv; - char *homedir; - char *result; - - if (((homedrv = getenv("HOMEDRIVE")) == NULL) || - ((homedir = getenv("HOMEPATH")) == NULL)) { - return (NULL); - } - if (nni_asprintf(&result, "%s%s", homedrv, homedir) == 0) { - return (result); - } - return (NULL); -} - int nni_plat_file_type(const char *name, int *typep) { @@ -366,4 +349,4 @@ nni_plat_file_unlock(nni_plat_flock *lk) lk->h = INVALID_HANDLE_VALUE; } -#endif // NNG_PLATFORM_WINDOWS
\ No newline at end of file +#endif // NNG_PLATFORM_WINDOWS diff --git a/tests/files.c b/tests/files.c index 3690ef63..bf6f704a 100644 --- a/tests/files.c +++ b/tests/files.c @@ -96,9 +96,6 @@ TestMain("Platform File Support", { So((d = nni_plat_temp_dir()) != NULL); nni_strfree(d); - So((d = nni_plat_home_dir()) != NULL); - nni_strfree(d); - So((d = nni_file_join("a", "b")) != NULL); So(d[0] == 'a'); So(d[2] == 'b'); @@ -142,7 +139,6 @@ TestMain("Platform File Support", { { So(nni_file_delete("/bogus/nng_does_not_exist") == 0); }); Convey("We can create a pair of files", { - char *temp; char *mydir; char *a; |
