repo.or.cz
/
musl.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
iconv: add euro symbol to GBK as single byte 0x80
[musl.git]
/
src
/
network
/
freeaddrinfo.c
blob
62241c239e27f8e09a4a437a104f595f69c16255
1
#include <stdlib.h>
2
#include <stddef.h>
3
#include <netdb.h>
4
#include
"lookup.h"
5
#include
"lock.h"
6
7
void
freeaddrinfo
(
struct
addrinfo
*
p
)
8
{
9
size_t
cnt
;
10
for
(
cnt
=
1
;
p
->
ai_next
;
cnt
++,
p
=
p
->
ai_next
);
11
struct
aibuf
*
b
= (
void
*)((
char
*)
p
-
offsetof
(
struct
aibuf
,
ai
));
12
b
-=
b
->
slot
;
13
LOCK
(
b
->
lock
);
14
if
(!(
b
->
ref
-=
cnt
))
free
(
b
);
15
else
UNLOCK
(
b
->
lock
);
16
}