Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
fcf05b24
Commit
fcf05b24
authored
Jan 13, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config_GetDataDirDefault(): return a heap-allocated string
parent
ee0fdf38
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
23 deletions
+22
-23
src/config/configuration.h
src/config/configuration.h
+1
-1
src/config/dirs.c
src/config/dirs.c
+2
-2
src/config/dirs_macos.c
src/config/dirs_macos.c
+5
-6
src/config/dirs_xdg.c
src/config/dirs_xdg.c
+3
-3
src/libvlc.c
src/libvlc.c
+9
-4
src/win32/dirs.c
src/win32/dirs.c
+2
-7
No files found.
src/config/configuration.h
View file @
fcf05b24
...
@@ -45,7 +45,7 @@ void config_UnsetCallbacks( module_config_t *, size_t );
...
@@ -45,7 +45,7 @@ void config_UnsetCallbacks( module_config_t *, size_t );
int
__config_LoadCmdLine
(
vlc_object_t
*
,
int
*
,
const
char
*
[],
bool
);
int
__config_LoadCmdLine
(
vlc_object_t
*
,
int
*
,
const
char
*
[],
bool
);
int
__config_LoadConfigFile
(
vlc_object_t
*
,
const
char
*
);
int
__config_LoadConfigFile
(
vlc_object_t
*
,
const
char
*
);
c
onst
c
har
*
config_GetDataDirDefault
(
void
);
char
*
config_GetDataDirDefault
(
void
);
int
IsConfigStringType
(
int
type
);
int
IsConfigStringType
(
int
type
);
int
IsConfigIntegerType
(
int
type
);
int
IsConfigIntegerType
(
int
type
);
...
...
src/config/dirs.c
View file @
fcf05b24
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
/**
/**
* Determines the shared data directory
* Determines the shared data directory
*
*
* @return a string
(always succeeds). Needs to be freed
.
* @return a string
or NULL. Use free() to release
.
*/
*/
char
*
__config_GetDataDir
(
vlc_object_t
*
p_obj
)
char
*
__config_GetDataDir
(
vlc_object_t
*
p_obj
)
{
{
...
@@ -41,6 +41,6 @@ char *__config_GetDataDir( vlc_object_t *p_obj )
...
@@ -41,6 +41,6 @@ char *__config_GetDataDir( vlc_object_t *p_obj )
if
(
psz_path
&&
*
psz_path
)
if
(
psz_path
&&
*
psz_path
)
return
psz_path
;
return
psz_path
;
free
(
psz_path
);
free
(
psz_path
);
return
strdup
(
config_GetDataDirDefault
()
);
return
config_GetDataDirDefault
(
);
}
}
src/config/dirs_macos.c
View file @
fcf05b24
...
@@ -36,16 +36,12 @@
...
@@ -36,16 +36,12 @@
#include "configuration.h"
#include "configuration.h"
static
char
*
configdir
=
NULL
;
static
char
*
configdir
=
NULL
;
static
char
*
datadir
=
NULL
;
static
pthread_once_t
once
=
PTHREAD_ONCE_INIT
;
static
pthread_once_t
once
=
PTHREAD_ONCE_INIT
;
static
void
init_dirs
(
void
)
static
void
init_dirs
(
void
)
{
{
configdir
=
config_GetUserDir
(
VLC_CONFIG_DIR
);
configdir
=
config_GetUserDir
(
VLC_CONFIG_DIR
);
int
ret
=
asprintf
(
&
datadir
,
"%s/share"
,
psz_vlcpath
);
if
(
ret
==
-
1
)
datadir
=
NULL
;
}
}
const
char
*
config_GetConfDir
(
void
)
const
char
*
config_GetConfDir
(
void
)
...
@@ -54,9 +50,12 @@ const char *config_GetConfDir( void )
...
@@ -54,9 +50,12 @@ const char *config_GetConfDir( void )
return
configdir
;
return
configdir
;
}
}
c
onst
c
har
*
config_GetDataDirDefault
(
void
)
char
*
config_GetDataDirDefault
(
void
)
{
{
pthread_once
(
&
once
,
init_dirs
);
char
*
datadir
;
if
(
asprintf
(
&
datadir
,
"%s/share"
,
psz_vlcpath
)
==
-
1
)
return
NULL
;
return
datadir
;
return
datadir
;
}
}
...
...
src/config/dirs_xdg.c
View file @
fcf05b24
...
@@ -39,11 +39,11 @@
...
@@ -39,11 +39,11 @@
/**
/**
* Determines the shared data directory
* Determines the shared data directory
*
*
* @return a
string (always succeeds)
.
* @return a
nul-terminated string or NULL. Use free() to release it
.
*/
*/
c
onst
char
*
config_GetDataDirDefault
(
void
)
c
har
*
config_GetDataDirDefault
(
void
)
{
{
return
DATA_PATH
;
return
strdup
(
DATA_PATH
)
;
}
}
/**
/**
...
...
src/libvlc.c
View file @
fcf05b24
...
@@ -1224,11 +1224,16 @@ static inline int LoadMessages (void)
...
@@ -1224,11 +1224,16 @@ static inline int LoadMessages (void)
static
const
char
psz_path
[]
=
LOCALEDIR
;
static
const
char
psz_path
[]
=
LOCALEDIR
;
#else
#else
char
psz_path
[
1024
];
char
psz_path
[
1024
];
if
(
snprintf
(
psz_path
,
sizeof
(
psz_path
),
"%s"
DIR_SEP
"%s"
,
char
*
datadir
=
config_GetDataDirDefault
();
config_GetDataDirDefault
(),
"locale"
)
int
ret
;
>=
(
int
)
sizeof
(
psz_path
))
return
-
1
;
if
(
unlikely
(
datadir
==
NULL
))
return
-
1
;
ret
=
snprintf
(
psz_path
,
sizeof
(
psz_path
),
"%s"
DIR_SEP
"locale"
,
datadir
);
free
(
datadir
);
if
(
ret
>=
(
int
)
sizeof
(
psz_path
))
return
-
1
;
#endif
#endif
if
(
bindtextdomain
(
PACKAGE_NAME
,
psz_path
)
==
NULL
)
if
(
bindtextdomain
(
PACKAGE_NAME
,
psz_path
)
==
NULL
)
{
{
...
...
src/win32/dirs.c
View file @
fcf05b24
...
@@ -44,14 +44,9 @@
...
@@ -44,14 +44,9 @@
#include <assert.h>
#include <assert.h>
#include <limits.h>
#include <limits.h>
c
onst
c
har
*
config_GetDataDirDefault
(
void
)
char
*
config_GetDataDirDefault
(
void
)
{
{
static
char
path
[
PATH_MAX
]
=
""
;
return
strdup
(
psz_vlcpath
);
#warning FIXME: thread-safety!
if
(
*
path
==
'\0'
)
strlcpy
(
path
,
psz_vlcpath
,
sizeof
(
path
));
return
path
;
}
}
const
char
*
config_GetConfDir
(
void
)
const
char
*
config_GetConfDir
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment