Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/BLI_fileops.h6
-rw-r--r--source/blender/blenlib/BLI_winstuff.h1
-rw-r--r--source/blender/blenlib/intern/storage.c15
3 files changed, 8 insertions, 14 deletions
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index 0a6d95df40a..ca82086b529 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -43,6 +43,12 @@ extern "C" {
/* for size_t (needed on windows) */
#include <stddef.h>
+#include <limits.h> /* for PATH_MAX */
+
+#ifndef PATH_MAX
+# define PATH_MAX 4096
+#endif
+
struct gzFile;
/* Common */
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index 20a4c3c274e..e75ec7eef2c 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -100,7 +100,6 @@ extern "C" {
// not accepted by access() on windows
//# define X_OK 1
# define F_OK 0
-# define PATH_MAX 4096
#endif
#ifndef FREE_WINDOWS
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index c1645c05359..e40527b1bb6 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -70,7 +70,6 @@
#ifdef WIN32
# include <io.h>
# include <direct.h>
-# include <limits.h> /* PATH_MAX */
# include "BLI_winstuff.h"
# include "utfconv.h"
#else
@@ -255,18 +254,11 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
struct dirlink * dlink = (struct dirlink *) dirbase.first;
struct direntry *file = &dir_ctx->files[dir_ctx->nrfiles];
while (dlink) {
-#ifdef PATH_MAX
- char static_fullname[PATH_MAX];
- char *fullname = static_fullname;
- size_t fullname_size = PATH_MAX;
-#else
- size_t fullname_size = strlen(dirname) + strlen(dlink->name) + 2;
- char *fullname = MEM_mallocN(fullname_size, "bli_builddir fullname");
-#endif
+ char fullname[PATH_MAX];
memset(file, 0, sizeof(struct direntry));
file->relname = dlink->name;
file->path = BLI_strdupcat(dirname, dlink->name);
- BLI_join_dirfile(fullname, fullname_size, dirname, dlink->name);
+ BLI_join_dirfile(fullname, sizeof(fullname), dirname, dlink->name);
// use 64 bit file size, only needed for WIN32 and WIN64.
// Excluding other than current MSVC compiler until able to test
#ifdef WIN32
@@ -288,9 +280,6 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
dir_ctx->nrfiles++;
file++;
dlink = dlink->next;
-#ifndef PATH_MAX
- MEM_freeN(fullname);
-#endif
}
}
else {