Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
bc1c8835
Commit
bc1c8835
authored
Aug 28, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
const pointers
The usual bunch of pointer arguments which should be const.
parent
801c71ed
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
16 deletions
+16
-16
interface.c
src/interface.c
+5
-5
interface.h
src/interface.h
+2
-2
sllist.c
src/sllist.c
+4
-4
sllist.h
src/sllist.h
+2
-2
tag.c
src/tag.c
+2
-2
tag.h
src/tag.h
+1
-1
No files found.
src/interface.c
View file @
bc1c8835
...
...
@@ -234,7 +234,7 @@ static void closeInterface(Interface * interface)
SECURE
(
"interface %i: closed
\n
"
,
interface
->
num
);
}
void
openAInterface
(
int
fd
,
struct
sockaddr
*
addr
)
void
openAInterface
(
int
fd
,
const
struct
sockaddr
*
addr
)
{
unsigned
int
i
;
...
...
@@ -249,7 +249,7 @@ void openAInterface(int fd, struct sockaddr *addr)
switch
(
addr
->
sa_family
)
{
#ifdef HAVE_TCP
case
AF_INET
:
hostname
=
(
const
char
*
)
inet_ntoa
(((
struct
sockaddr_in
*
)
hostname
=
(
const
char
*
)
inet_ntoa
(((
const
struct
sockaddr_in
*
)
addr
)
->
sin_addr
);
if
(
!
hostname
)
hostname
=
"error getting ipv4 address"
;
...
...
@@ -259,8 +259,8 @@ void openAInterface(int fd, struct sockaddr *addr)
{
static
char
host
[
INET6_ADDRSTRLEN
+
1
];
memset
(
host
,
0
,
INET6_ADDRSTRLEN
+
1
);
if
(
inet_ntop
(
AF_INET6
,
(
void
*
)
&
(((
struct
sockaddr_in6
*
)
addr
)
->
if
(
inet_ntop
(
AF_INET6
,
(
const
void
*
)
&
(((
const
struct
sockaddr_in6
*
)
addr
)
->
sin6_addr
),
host
,
INET6_ADDRSTRLEN
))
{
hostname
=
(
const
char
*
)
host
;
...
...
@@ -689,7 +689,7 @@ static void flushInterfaceBuffer(Interface * interface)
}
}
int
interfacePrintWithFD
(
int
fd
,
char
*
buffer
,
size_t
buflen
)
int
interfacePrintWithFD
(
int
fd
,
c
onst
c
har
*
buffer
,
size_t
buflen
)
{
static
unsigned
int
i
;
size_t
copylen
;
...
...
src/interface.h
View file @
bc1c8835
...
...
@@ -22,10 +22,10 @@
#include "os_compat.h"
void
initInterfaces
(
void
);
void
openAInterface
(
int
fd
,
struct
sockaddr
*
addr
);
void
openAInterface
(
int
fd
,
const
struct
sockaddr
*
addr
);
void
freeAllInterfaces
(
void
);
void
closeOldInterfaces
(
void
);
int
interfacePrintWithFD
(
int
fd
,
char
*
buffer
,
size_t
len
);
int
interfacePrintWithFD
(
int
fd
,
c
onst
c
har
*
buffer
,
size_t
len
);
int
doIOForInterfaces
(
void
);
...
...
src/sllist.c
View file @
bc1c8835
...
...
@@ -34,22 +34,22 @@ struct strnode *new_strnode(char *s)
return
x
;
}
struct
strnode
*
new_strnode_dup
(
char
*
s
,
const
size_t
size
)
struct
strnode
*
new_strnode_dup
(
c
onst
c
har
*
s
,
const
size_t
size
)
{
struct
strnode
*
x
=
xmalloc
(
sizeof
(
struct
strnode
)
+
size
);
x
->
next
=
NULL
;
x
->
data
=
((
char
*
)
x
+
sizeof
(
struct
strnode
));
memcpy
((
void
*
)
x
->
data
,
(
void
*
)
s
,
size
);
memcpy
((
void
*
)
x
->
data
,
(
const
void
*
)
s
,
size
);
return
x
;
}
struct
sllnode
*
new_sllnode
(
void
*
s
,
const
size_t
size
)
struct
sllnode
*
new_sllnode
(
const
void
*
s
,
const
size_t
size
)
{
struct
sllnode
*
x
=
xmalloc
(
sizeof
(
struct
sllnode
)
+
size
);
x
->
next
=
NULL
;
x
->
size
=
size
;
x
->
data
=
((
char
*
)
x
+
sizeof
(
struct
sllnode
));
memcpy
(
x
->
data
,
(
void
*
)
s
,
size
);
memcpy
(
x
->
data
,
(
const
void
*
)
s
,
size
);
return
x
;
}
...
...
src/sllist.h
View file @
bc1c8835
...
...
@@ -42,11 +42,11 @@ struct sllnode {
struct
strnode
*
new_strnode
(
char
*
s
);
struct
strnode
*
new_strnode_dup
(
char
*
s
,
const
size_t
size
);
struct
strnode
*
new_strnode_dup
(
c
onst
c
har
*
s
,
const
size_t
size
);
struct
strnode
*
dup_strlist
(
struct
strnode
*
old
);
struct
sllnode
*
new_sllnode
(
void
*
s
,
const
size_t
size
);
struct
sllnode
*
new_sllnode
(
const
void
*
s
,
const
size_t
size
);
#endif
/* SLLIST_H */
src/tag.c
View file @
bc1c8835
...
...
@@ -697,7 +697,7 @@ int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2)
}
static
void
appendToTagItems
(
MpdTag
*
tag
,
enum
tag_type
type
,
char
*
value
,
size_t
len
)
c
onst
c
har
*
value
,
size_t
len
)
{
unsigned
int
i
=
tag
->
numOfItems
;
char
*
duplicated
=
xmalloc
(
len
+
1
);
...
...
@@ -718,7 +718,7 @@ static void appendToTagItems(MpdTag * tag, enum tag_type type,
}
void
addItemToMpdTagWithLen
(
MpdTag
*
tag
,
enum
tag_type
itemType
,
char
*
value
,
size_t
len
)
c
onst
c
har
*
value
,
size_t
len
)
{
if
(
ignoreTagItems
[
itemType
])
{
...
...
src/tag.h
View file @
bc1c8835
...
...
@@ -73,7 +73,7 @@ void clearItemsFromMpdTag(MpdTag * tag, enum tag_type itemType);
void
freeMpdTag
(
MpdTag
*
tag
);
void
addItemToMpdTagWithLen
(
MpdTag
*
tag
,
enum
tag_type
itemType
,
char
*
value
,
size_t
len
);
c
onst
c
har
*
value
,
size_t
len
);
#define addItemToMpdTag(tag, itemType, value) \
addItemToMpdTagWithLen(tag, itemType, value, strlen(value))
...
...
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