Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
d38c4f98
Commit
d38c4f98
authored
Feb 14, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
directory: remove useless string if fdopendir() is supported
parent
66150e51
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
modules/access/directory.c
modules/access/directory.c
+18
-7
No files found.
modules/access/directory.c
View file @
d38c4f98
...
@@ -76,7 +76,9 @@ struct directory_t
...
@@ -76,7 +76,9 @@ struct directory_t
#ifndef WIN32
#ifndef WIN32
struct
stat
st
;
struct
stat
st
;
#endif
#endif
char
path
[
1
];
#ifndef HAVE_FDOPENDIR
char
*
path
;
#endif
};
};
struct
access_sys_t
struct
access_sys_t
...
@@ -173,6 +175,9 @@ void DirClose( vlc_object_t * p_this )
...
@@ -173,6 +175,9 @@ void DirClose( vlc_object_t * p_this )
p_sys
->
current
=
current
->
parent
;
p_sys
->
current
=
current
->
parent
;
closedir
(
current
->
handle
);
closedir
(
current
->
handle
);
free
(
current
->
uri
);
free
(
current
->
uri
);
#ifndef HAVE_FDOPENDIR
free
(
current
->
path
);
#endif
free
(
current
);
free
(
current
);
}
}
...
@@ -224,7 +229,7 @@ block_t *DirBlock (access_t *p_access)
...
@@ -224,7 +229,7 @@ block_t *DirBlock (access_t *p_access)
memcpy
(
block
->
p_buffer
,
header
,
sizeof
(
header
)
-
1
);
memcpy
(
block
->
p_buffer
,
header
,
sizeof
(
header
)
-
1
);
/* "Open" the base directory */
/* "Open" the base directory */
current
=
malloc
(
sizeof
(
*
current
)
+
strlen
(
p_access
->
psz_path
)
);
current
=
malloc
(
sizeof
(
*
current
));
if
(
current
==
NULL
)
if
(
current
==
NULL
)
{
{
block_Release
(
block
);
block_Release
(
block
);
...
@@ -232,7 +237,9 @@ block_t *DirBlock (access_t *p_access)
...
@@ -232,7 +237,9 @@ block_t *DirBlock (access_t *p_access)
}
}
current
->
parent
=
NULL
;
current
->
parent
=
NULL
;
current
->
handle
=
p_sys
->
handle
;
current
->
handle
=
p_sys
->
handle
;
strcpy
(
current
->
path
,
p_access
->
psz_path
);
#ifndef HAVE_FDOPENDIR
current
->
path
=
strdup
(
p_access
->
psz_path
);
#endif
current
->
uri
=
p_sys
->
uri
;
current
->
uri
=
p_sys
->
uri
;
if
(
fstat
(
dirfd
(
current
->
handle
),
&
current
->
st
))
if
(
fstat
(
dirfd
(
current
->
handle
),
&
current
->
st
))
{
{
...
@@ -253,6 +260,9 @@ block_t *DirBlock (access_t *p_access)
...
@@ -253,6 +260,9 @@ block_t *DirBlock (access_t *p_access)
closedir
(
current
->
handle
);
closedir
(
current
->
handle
);
p_sys
->
current
=
current
->
parent
;
p_sys
->
current
=
current
->
parent
;
free
(
current
->
uri
);
free
(
current
->
uri
);
#ifndef HAVE_FDOPENDIR
free
(
current
->
path
);
#endif
free
(
current
);
free
(
current
);
if
(
p_sys
->
current
==
NULL
)
if
(
p_sys
->
current
==
NULL
)
...
@@ -297,14 +307,12 @@ block_t *DirBlock (access_t *p_access)
...
@@ -297,14 +307,12 @@ block_t *DirBlock (access_t *p_access)
/* Handle recursion */
/* Handle recursion */
if
(
p_sys
->
mode
!=
MODE_COLLAPSE
)
if
(
p_sys
->
mode
!=
MODE_COLLAPSE
)
{
{
directory_t
*
sub
=
malloc
(
sizeof
(
*
sub
)
+
strlen
(
current
->
path
)
+
1
directory_t
*
sub
=
malloc
(
sizeof
(
*
sub
));
+
strlen
(
entry
));
if
(
sub
==
NULL
)
if
(
sub
==
NULL
)
{
{
free
(
entry
);
free
(
entry
);
return
NULL
;
return
NULL
;
}
}
sprintf
(
sub
->
path
,
"%s/%s"
,
current
->
path
,
entry
);
DIR
*
handle
;
DIR
*
handle
;
#ifdef HAVE_FDOPENDIR
#ifdef HAVE_FDOPENDIR
...
@@ -319,7 +327,10 @@ block_t *DirBlock (access_t *p_access)
...
@@ -319,7 +327,10 @@ block_t *DirBlock (access_t *p_access)
else
else
handle
=
NULL
;
handle
=
NULL
;
#else
#else
if
(
asprintf
(
&
sub
->
path
,
"%s/%s"
,
current
->
path
,
entry
)
!=
-
1
)
handle
=
vlc_opendir
(
sub
->
path
);
handle
=
vlc_opendir
(
sub
->
path
);
else
handle
=
NULL
;
#endif
#endif
if
(
handle
!=
NULL
)
if
(
handle
!=
NULL
)
{
{
...
...
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