diff options
Diffstat (limited to 'src/polypcore')
55 files changed, 95 insertions, 234 deletions
diff --git a/src/polypcore/authkey-prop.c b/src/polypcore/authkey-prop.c index 3faf0ef1..6172d432 100644 --- a/src/polypcore/authkey-prop.c +++ b/src/polypcore/authkey-prop.c @@ -22,7 +22,8 @@ #include <assert.h> #include <string.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/props.h> #include <polypcore/log.h> diff --git a/src/polypcore/autoload.c b/src/polypcore/autoload.c index 8d2dca30..386de219 100644 --- a/src/polypcore/autoload.c +++ b/src/polypcore/autoload.c @@ -27,8 +27,9 @@ #include <stdlib.h> #include <string.h> +#include <polyp/xmalloc.h> + #include <polypcore/module.h> -#include <polypcore/xmalloc.h> #include <polypcore/memchunk.h> #include <polypcore/sound-file.h> #include <polypcore/log.h> diff --git a/src/polypcore/cli-command.c b/src/polypcore/cli-command.c index 180c61e9..5556bcb3 100644 --- a/src/polypcore/cli-command.c +++ b/src/polypcore/cli-command.c @@ -29,6 +29,8 @@ #include <stdlib.h> #include <errno.h> +#include <polyp/xmalloc.h> + #include <polypcore/module.h> #include <polypcore/sink.h> #include <polypcore/source.h> @@ -44,7 +46,6 @@ #include <polypcore/sound-file.h> #include <polypcore/play-memchunk.h> #include <polypcore/autoload.h> -#include <polypcore/xmalloc.h> #include <polypcore/sound-file-stream.h> #include <polypcore/props.h> #include <polypcore/util.h> diff --git a/src/polypcore/cli-text.c b/src/polypcore/cli-text.c index 74de5781..09ccaa00 100644 --- a/src/polypcore/cli-text.c +++ b/src/polypcore/cli-text.c @@ -27,6 +27,8 @@ #include <string.h> #include <polyp/volume.h> +#include <polyp/xmalloc.h> + #include <polypcore/module.h> #include <polypcore/client.h> #include <polypcore/sink.h> @@ -37,7 +39,6 @@ #include <polypcore/sample-util.h> #include <polypcore/core-scache.h> #include <polypcore/autoload.h> -#include <polypcore/xmalloc.h> #include "cli-text.h" diff --git a/src/polypcore/cli.c b/src/polypcore/cli.c index 583f6845..683d29ec 100644 --- a/src/polypcore/cli.c +++ b/src/polypcore/cli.c @@ -28,6 +28,8 @@ #include <assert.h> #include <stdlib.h> +#include <polyp/xmalloc.h> + #include <polypcore/ioline.h> #include <polypcore/module.h> #include <polypcore/sink.h> @@ -40,7 +42,6 @@ #include <polypcore/namereg.h> #include <polypcore/cli-text.h> #include <polypcore/cli-command.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include "cli.h" diff --git a/src/polypcore/client.c b/src/polypcore/client.c index be970470..b5ed2fd0 100644 --- a/src/polypcore/client.c +++ b/src/polypcore/client.c @@ -28,7 +28,8 @@ #include <stdlib.h> #include <string.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/core-subscribe.h> #include <polypcore/log.h> diff --git a/src/polypcore/conf-parser.c b/src/polypcore/conf-parser.c index 26fc33b5..64e66c2e 100644 --- a/src/polypcore/conf-parser.c +++ b/src/polypcore/conf-parser.c @@ -28,9 +28,10 @@ #include <stdio.h> #include <errno.h> +#include <polyp/xmalloc.h> + #include <polypcore/log.h> #include <polypcore/util.h> -#include <polypcore/xmalloc.h> #include "conf-parser.h" diff --git a/src/polypcore/core-scache.c b/src/polypcore/core-scache.c index 3bba38ed..8080fcd6 100644 --- a/src/polypcore/core-scache.c +++ b/src/polypcore/core-scache.c @@ -44,10 +44,11 @@ #include <polyp/mainloop.h> #include <polyp/channelmap.h> #include <polyp/volume.h> +#include <polyp/xmalloc.h> + #include <polypcore/sink-input.h> #include <polypcore/sample-util.h> #include <polypcore/play-memchunk.h> -#include <polypcore/xmalloc.h> #include <polypcore/core-subscribe.h> #include <polypcore/namereg.h> #include <polypcore/sound-file.h> diff --git a/src/polypcore/core-subscribe.c b/src/polypcore/core-subscribe.c index fa6c0e50..52babb7a 100644 --- a/src/polypcore/core-subscribe.c +++ b/src/polypcore/core-subscribe.c @@ -26,8 +26,9 @@ #include <stdio.h> #include <assert.h> +#include <polyp/xmalloc.h> + #include <polypcore/queue.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include "core-subscribe.h" diff --git a/src/polypcore/core.c b/src/polypcore/core.c index 0093aebd..ff8ec081 100644 --- a/src/polypcore/core.c +++ b/src/polypcore/core.c @@ -28,6 +28,8 @@ #include <stdio.h> #include <signal.h> +#include <polyp/xmalloc.h> + #include <polypcore/module.h> #include <polypcore/sink.h> #include <polypcore/source.h> @@ -35,7 +37,6 @@ #include <polypcore/util.h> #include <polypcore/core-scache.h> #include <polypcore/autoload.h> -#include <polypcore/xmalloc.h> #include <polypcore/core-subscribe.h> #include <polypcore/props.h> #include <polypcore/random.h> diff --git a/src/polypcore/dynarray.c b/src/polypcore/dynarray.c index 1aff7f51..234c2c03 100644 --- a/src/polypcore/dynarray.c +++ b/src/polypcore/dynarray.c @@ -27,7 +27,7 @@ #include <assert.h> #include <stdlib.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> #include "dynarray.h" diff --git a/src/polypcore/hashmap.c b/src/polypcore/hashmap.c index 8861fd3d..adc322f0 100644 --- a/src/polypcore/hashmap.c +++ b/src/polypcore/hashmap.c @@ -27,8 +27,9 @@ #include <assert.h> #include <string.h> +#include <polyp/xmalloc.h> + #include <polypcore/idxset.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include "hashmap.h" diff --git a/src/polypcore/idxset.c b/src/polypcore/idxset.c index f970ae5e..bde5c279 100644 --- a/src/polypcore/idxset.c +++ b/src/polypcore/idxset.c @@ -28,7 +28,7 @@ #include <stdlib.h> #include <string.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> #include "idxset.h" diff --git a/src/polypcore/iochannel.c b/src/polypcore/iochannel.c index aba0399c..a1ad5dea 100644 --- a/src/polypcore/iochannel.c +++ b/src/polypcore/iochannel.c @@ -38,9 +38,10 @@ #include "winsock.h" +#include <polyp/xmalloc.h> + #include <polypcore/util.h> #include <polypcore/socket-util.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include "iochannel.h" diff --git a/src/polypcore/ioline.c b/src/polypcore/ioline.c index eb8fdda5..9bb610fe 100644 --- a/src/polypcore/ioline.c +++ b/src/polypcore/ioline.c @@ -29,7 +29,8 @@ #include <stdlib.h> #include <string.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/log.h> #include "ioline.h" diff --git a/src/polypcore/log.c b/src/polypcore/log.c index 9c9ed2fd..9908d168 100644 --- a/src/polypcore/log.c +++ b/src/polypcore/log.c @@ -33,7 +33,8 @@ #include <syslog.h> #endif -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/util.h> #include "log.h" diff --git a/src/polypcore/mcalign.c b/src/polypcore/mcalign.c index f90fd7e8..d9267f99 100644 --- a/src/polypcore/mcalign.c +++ b/src/polypcore/mcalign.c @@ -28,7 +28,7 @@ #include <assert.h> #include <string.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> #include "mcalign.h" diff --git a/src/polypcore/memblock.c b/src/polypcore/memblock.c index 04e8436f..a0e5135b 100644 --- a/src/polypcore/memblock.c +++ b/src/polypcore/memblock.c @@ -28,7 +28,7 @@ #include <assert.h> #include <string.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> #include "memblock.h" diff --git a/src/polypcore/memblockq.c b/src/polypcore/memblockq.c index 90e1d9eb..caacd96f 100644 --- a/src/polypcore/memblockq.c +++ b/src/polypcore/memblockq.c @@ -30,7 +30,8 @@ #include <stdlib.h> #include <string.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/log.h> #include <polypcore/mcalign.h> diff --git a/src/polypcore/memchunk.c b/src/polypcore/memchunk.c index d6856ab8..918b3f0f 100644 --- a/src/polypcore/memchunk.c +++ b/src/polypcore/memchunk.c @@ -28,7 +28,7 @@ #include <assert.h> #include <string.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> #include "memchunk.h" diff --git a/src/polypcore/modargs.c b/src/polypcore/modargs.c index 713326bf..63cc779d 100644 --- a/src/polypcore/modargs.c +++ b/src/polypcore/modargs.c @@ -28,13 +28,14 @@ #include <stdlib.h> #include <string.h> +#include <polyp/xmalloc.h> + #include <polypcore/hashmap.h> #include <polypcore/idxset.h> #include <polypcore/sample-util.h> #include <polypcore/namereg.h> #include <polypcore/sink.h> #include <polypcore/source.h> -#include <polypcore/xmalloc.h> #include <polypcore/util.h> #include "modargs.h" diff --git a/src/polypcore/modinfo.c b/src/polypcore/modinfo.c index 39186ceb..241076c6 100644 --- a/src/polypcore/modinfo.c +++ b/src/polypcore/modinfo.c @@ -26,7 +26,8 @@ #include <ltdl.h> #include <assert.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/util.h> #include <polypcore/log.h> diff --git a/src/polypcore/module.c b/src/polypcore/module.c index 5412f397..fe177a5b 100644 --- a/src/polypcore/module.c +++ b/src/polypcore/module.c @@ -30,7 +30,8 @@ #include <string.h> #include <errno.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/core-subscribe.h> #include <polypcore/log.h> #include <polypcore/util.h> diff --git a/src/polypcore/namereg.c b/src/polypcore/namereg.c index 9229a0f9..cf11f5a4 100644 --- a/src/polypcore/namereg.c +++ b/src/polypcore/namereg.c @@ -29,10 +29,11 @@ #include <string.h> #include <stdio.h> +#include <polyp/xmalloc.h> + #include <polypcore/autoload.h> #include <polypcore/source.h> #include <polypcore/sink.h> -#include <polypcore/xmalloc.h> #include <polypcore/core-subscribe.h> #include <polypcore/util.h> diff --git a/src/polypcore/packet.c b/src/polypcore/packet.c index 31ddad95..646b59e0 100644 --- a/src/polypcore/packet.c +++ b/src/polypcore/packet.c @@ -26,7 +26,7 @@ #include <assert.h> #include <stdlib.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> #include "packet.h" diff --git a/src/polypcore/parseaddr.c b/src/polypcore/parseaddr.c index c2b25c89..7e518a5d 100644 --- a/src/polypcore/parseaddr.c +++ b/src/polypcore/parseaddr.c @@ -27,7 +27,8 @@ #include <assert.h> #include <stdlib.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/util.h> #include "parseaddr.h" diff --git a/src/polypcore/pdispatch.c b/src/polypcore/pdispatch.c index b087f1a5..21e3644e 100644 --- a/src/polypcore/pdispatch.c +++ b/src/polypcore/pdispatch.c @@ -27,8 +27,9 @@ #include <stdlib.h> #include <assert.h> +#include <polyp/xmalloc.h> + #include <polypcore/native-common.h> -#include <polypcore/xmalloc.h> #include <polypcore/llist.h> #include <polypcore/log.h> #include <polypcore/util.h> diff --git a/src/polypcore/pid.c b/src/polypcore/pid.c index b258290b..53b8ad0a 100644 --- a/src/polypcore/pid.c +++ b/src/polypcore/pid.c @@ -39,9 +39,10 @@ #include <windows.h> #endif +#include <polyp/xmalloc.h> + #include <polypcore/util.h> #include <polypcore/log.h> -#include <polypcore/xmalloc.h> #include "pid.h" diff --git a/src/polypcore/play-memchunk.c b/src/polypcore/play-memchunk.c index 37ebdcf1..982cedc7 100644 --- a/src/polypcore/play-memchunk.c +++ b/src/polypcore/play-memchunk.c @@ -28,8 +28,9 @@ #include <stdio.h> #include <string.h> +#include <polyp/xmalloc.h> + #include <polypcore/sink-input.h> -#include <polypcore/xmalloc.h> #include <polypcore/gccmacro.h> #include "play-memchunk.h" diff --git a/src/polypcore/props.c b/src/polypcore/props.c index 96cdc4f2..1db44ee7 100644 --- a/src/polypcore/props.c +++ b/src/polypcore/props.c @@ -21,7 +21,8 @@ #include <assert.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/log.h> #include "props.h" diff --git a/src/polypcore/protocol-cli.c b/src/polypcore/protocol-cli.c index 7dd489f7..076411cf 100644 --- a/src/polypcore/protocol-cli.c +++ b/src/polypcore/protocol-cli.c @@ -26,8 +26,9 @@ #include <assert.h> #include <stdlib.h> +#include <polyp/xmalloc.h> + #include <polypcore/cli.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include "protocol-cli.h" diff --git a/src/polypcore/protocol-esound.c b/src/polypcore/protocol-esound.c index fcbeba6d..86a8c9e3 100644 --- a/src/polypcore/protocol-esound.c +++ b/src/polypcore/protocol-esound.c @@ -31,6 +31,8 @@ #include <limits.h> #include <polyp/sample.h> +#include <polyp/xmalloc.h> + #include <polypcore/esound.h> #include <polypcore/memblock.h> #include <polypcore/client.h> @@ -42,7 +44,6 @@ #include <polypcore/sample-util.h> #include <polypcore/authkey.h> #include <polypcore/namereg.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include <polypcore/util.h> #include <polypcore/utf8.h> diff --git a/src/polypcore/protocol-http.c b/src/polypcore/protocol-http.c index 85ddebee..68864237 100644 --- a/src/polypcore/protocol-http.c +++ b/src/polypcore/protocol-http.c @@ -28,8 +28,9 @@ #include <stdio.h> #include <string.h> +#include <polyp/xmalloc.h> + #include <polypcore/ioline.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include <polypcore/namereg.h> #include <polypcore/cli-text.h> diff --git a/src/polypcore/protocol-native.c b/src/polypcore/protocol-native.c index 3b904134..b0ad5955 100644 --- a/src/polypcore/protocol-native.c +++ b/src/polypcore/protocol-native.c @@ -30,6 +30,7 @@ #include <unistd.h> #include <polyp/version.h> +#include <polyp/xmalloc.h> #include <polypcore/native-common.h> #include <polypcore/packet.h> @@ -43,7 +44,6 @@ #include <polypcore/authkey.h> #include <polypcore/namereg.h> #include <polypcore/core-scache.h> -#include <polypcore/xmalloc.h> #include <polypcore/util.h> #include <polypcore/core-subscribe.h> #include <polypcore/log.h> diff --git a/src/polypcore/protocol-simple.c b/src/polypcore/protocol-simple.c index 1e3b169c..caffd5c9 100644 --- a/src/polypcore/protocol-simple.c +++ b/src/polypcore/protocol-simple.c @@ -30,12 +30,13 @@ #include <errno.h> #include <string.h> +#include <polyp/xmalloc.h> + #include <polypcore/sink-input.h> #include <polypcore/source-output.h> #include <polypcore/client.h> #include <polypcore/sample-util.h> #include <polypcore/namereg.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include "protocol-simple.h" diff --git a/src/polypcore/pstream.c b/src/polypcore/pstream.c index 09bd1e27..074cab91 100644 --- a/src/polypcore/pstream.c +++ b/src/polypcore/pstream.c @@ -34,8 +34,9 @@ #include "winsock.h" +#include <polyp/xmalloc.h> + #include <polypcore/queue.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include <polypcore/core-scache.h> diff --git a/src/polypcore/queue.c b/src/polypcore/queue.c index 77ca1ed3..01f957d9 100644 --- a/src/polypcore/queue.c +++ b/src/polypcore/queue.c @@ -26,7 +26,7 @@ #include <assert.h> #include <stdlib.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> #include "queue.h" diff --git a/src/polypcore/resampler.c b/src/polypcore/resampler.c index b2a8874b..33e8c295 100644 --- a/src/polypcore/resampler.c +++ b/src/polypcore/resampler.c @@ -30,8 +30,9 @@ #include <liboil/liboilfuncs.h> #include <liboil/liboil.h> +#include <polyp/xmalloc.h> + #include <polypcore/sconv.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include "resampler.h" diff --git a/src/polypcore/sink-input.c b/src/polypcore/sink-input.c index c1026390..5c0caa21 100644 --- a/src/polypcore/sink-input.c +++ b/src/polypcore/sink-input.c @@ -28,8 +28,9 @@ #include <stdlib.h> #include <string.h> +#include <polyp/xmalloc.h> + #include <polypcore/sample-util.h> -#include <polypcore/xmalloc.h> #include <polypcore/core-subscribe.h> #include <polypcore/log.h> #include <polypcore/utf8.h> diff --git a/src/polypcore/sink.c b/src/polypcore/sink.c index b59f1eaa..a873c00a 100644 --- a/src/polypcore/sink.c +++ b/src/polypcore/sink.c @@ -29,12 +29,12 @@ #include <stdio.h> #include <polyp/introspect.h> +#include <polyp/xmalloc.h> #include <polypcore/sink-input.h> #include <polypcore/namereg.h> #include <polypcore/util.h> #include <polypcore/sample-util.h> -#include <polypcore/xmalloc.h> #include <polypcore/core-subscribe.h> #include <polypcore/log.h> #include <polypcore/utf8.h> diff --git a/src/polypcore/socket-client.c b/src/polypcore/socket-client.c index 734b9dde..a61cf582 100644 --- a/src/polypcore/socket-client.c +++ b/src/polypcore/socket-client.c @@ -54,9 +54,10 @@ #include "winsock.h" +#include <polyp/xmalloc.h> + #include <polypcore/socket-util.h> #include <polypcore/util.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include <polypcore/parseaddr.h> diff --git a/src/polypcore/socket-server.c b/src/polypcore/socket-server.c index f7e0b647..959173f2 100644 --- a/src/polypcore/socket-server.c +++ b/src/polypcore/socket-server.c @@ -62,8 +62,9 @@ #include "winsock.h" +#include <polyp/xmalloc.h> + #include <polypcore/socket-util.h> -#include <polypcore/xmalloc.h> #include <polypcore/util.h> #include <polypcore/log.h> diff --git a/src/polypcore/socket-util.c b/src/polypcore/socket-util.c index 915c7f22..0961db21 100644 --- a/src/polypcore/socket-util.c +++ b/src/polypcore/socket-util.c @@ -59,8 +59,9 @@ #include "winsock.h" +#include <polyp/xmalloc.h> + #include <polypcore/util.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include "socket-util.h" diff --git a/src/polypcore/sound-file-stream.c b/src/polypcore/sound-file-stream.c index fdacea54..68fd8a89 100644 --- a/src/polypcore/sound-file-stream.c +++ b/src/polypcore/sound-file-stream.c @@ -30,8 +30,9 @@ #include <sndfile.h> +#include <polyp/xmalloc.h> + #include <polypcore/sink-input.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include "sound-file-stream.h" diff --git a/src/polypcore/source-output.c b/src/polypcore/source-output.c index b3113071..c8db870b 100644 --- a/src/polypcore/source-output.c +++ b/src/polypcore/source-output.c @@ -28,7 +28,8 @@ #include <stdlib.h> #include <string.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/core-subscribe.h> #include <polypcore/log.h> #include <polypcore/utf8.h> diff --git a/src/polypcore/source.c b/src/polypcore/source.c index fca281a7..4d96622b 100644 --- a/src/polypcore/source.c +++ b/src/polypcore/source.c @@ -28,9 +28,10 @@ #include <stdlib.h> #include <string.h> +#include <polyp/xmalloc.h> + #include <polypcore/source-output.h> #include <polypcore/namereg.h> -#include <polypcore/xmalloc.h> #include <polypcore/core-subscribe.h> #include <polypcore/log.h> #include <polypcore/sample-util.h> diff --git a/src/polypcore/strbuf.c b/src/polypcore/strbuf.c index dcad5e78..d1517a11 100644 --- a/src/polypcore/strbuf.c +++ b/src/polypcore/strbuf.c @@ -30,7 +30,7 @@ #include <stdarg.h> #include <stdio.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> #include "strbuf.h" diff --git a/src/polypcore/strlist.c b/src/polypcore/strlist.c index e165aefd..4d70e9e9 100644 --- a/src/polypcore/strlist.c +++ b/src/polypcore/strlist.c @@ -26,7 +26,8 @@ #include <string.h> #include <assert.h> -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/strbuf.h> #include <polypcore/util.h> diff --git a/src/polypcore/tagstruct.c b/src/polypcore/tagstruct.c index 86b8368a..27582cae 100644 --- a/src/polypcore/tagstruct.c +++ b/src/polypcore/tagstruct.c @@ -36,7 +36,7 @@ #include "winsock.h" -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> #include "tagstruct.h" diff --git a/src/polypcore/tokenizer.c b/src/polypcore/tokenizer.c index 556a190a..667643fe 100644 --- a/src/polypcore/tokenizer.c +++ b/src/polypcore/tokenizer.c @@ -27,8 +27,9 @@ #include <assert.h> #include <stdlib.h> +#include <polyp/xmalloc.h> + #include <polypcore/dynarray.h> -#include <polypcore/xmalloc.h> #include <polypcore/gccmacro.h> #include "tokenizer.h" diff --git a/src/polypcore/utf8.c b/src/polypcore/utf8.c index bb8621e2..01fbfccd 100644 --- a/src/polypcore/utf8.c +++ b/src/polypcore/utf8.c @@ -33,8 +33,9 @@ #include <inttypes.h> #include <string.h> +#include <polyp/xmalloc.h> + #include "utf8.h" -#include "xmalloc.h" #define FILTER_CHAR '_' diff --git a/src/polypcore/util.c b/src/polypcore/util.c index 6f7f8819..9783b746 100644 --- a/src/polypcore/util.c +++ b/src/polypcore/util.c @@ -70,7 +70,8 @@ #include "winsock.h" -#include <polypcore/xmalloc.h> +#include <polyp/xmalloc.h> + #include <polypcore/log.h> #include "util.h" diff --git a/src/polypcore/x11wrap.c b/src/polypcore/x11wrap.c index c1ca83ca..41a40764 100644 --- a/src/polypcore/x11wrap.c +++ b/src/polypcore/x11wrap.c @@ -22,8 +22,9 @@ #include <assert.h> #include <stdio.h> +#include <polyp/xmalloc.h> + #include <polypcore/llist.h> -#include <polypcore/xmalloc.h> #include <polypcore/log.h> #include <polypcore/props.h> diff --git a/src/polypcore/xmalloc.c b/src/polypcore/xmalloc.c deleted file mode 100644 index 4c8689a6..00000000 --- a/src/polypcore/xmalloc.c +++ /dev/null @@ -1,123 +0,0 @@ -/* $Id$ */ - -/*** - This file is part of polypaudio. - - polypaudio is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - polypaudio is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with polypaudio; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA. -***/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <signal.h> -#include <assert.h> -#include <unistd.h> -#include <string.h> - -#include <polypcore/util.h> -#include <polypcore/gccmacro.h> - -#include "xmalloc.h" - -/* Make sure not to allocate more than this much memory. */ -#define MAX_ALLOC_SIZE (1024*1024*20) /* 20MB */ - -/* #undef malloc */ -/* #undef free */ -/* #undef realloc */ -/* #undef strndup */ -/* #undef strdup */ - -static void oom(void) PA_GCC_NORETURN; - -/** called in case of an OOM situation. Prints an error message and - * exits */ -static void oom(void) { - static const char e[] = "Not enough memory\n"; - pa_loop_write(STDERR_FILENO, e, sizeof(e)-1); -#ifdef SIGQUIT - raise(SIGQUIT); -#endif - _exit(1); -} - -void* pa_xmalloc(size_t size) { - void *p; - assert(size > 0); - assert(size < MAX_ALLOC_SIZE); - - if (!(p = malloc(size))) - oom(); - - return p; -} - -void* pa_xmalloc0(size_t size) { - void *p; - assert(size > 0); - assert(size < MAX_ALLOC_SIZE); - - if (!(p = calloc(1, size))) - oom(); - - return p; -} - -void *pa_xrealloc(void *ptr, size_t size) { - void *p; - assert(size > 0); - assert(size < MAX_ALLOC_SIZE); - - if (!(p = realloc(ptr, size))) - oom(); - return p; -} - -void* pa_xmemdup(const void *p, size_t l) { - if (!p) - return NULL; - else { - char *r = pa_xmalloc(l); - memcpy(r, p, l); - return r; - } -} - -char *pa_xstrdup(const char *s) { - if (!s) - return NULL; - - return pa_xmemdup(s, strlen(s)+1); -} - -char *pa_xstrndup(const char *s, size_t l) { - if (!s) - return NULL; - else { - char *r; - size_t t = strlen(s); - - if (t > l) - t = l; - - r = pa_xmemdup(s, t+1); - r[t] = 0; - return r; - } -} - diff --git a/src/polypcore/xmalloc.h b/src/polypcore/xmalloc.h deleted file mode 100644 index 2946011a..00000000 --- a/src/polypcore/xmalloc.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef foomemoryhfoo -#define foomemoryhfoo - -/* $Id$ */ - -/*** - This file is part of polypaudio. - - polypaudio is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - polypaudio is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with polypaudio; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA. -***/ - -#include <sys/types.h> -#include <stdlib.h> -#include <limits.h> -#include <assert.h> - -void* pa_xmalloc(size_t l); -void *pa_xmalloc0(size_t l); -void *pa_xrealloc(void *ptr, size_t size); -#define pa_xfree free - -char *pa_xstrdup(const char *s); -char *pa_xstrndup(const char *s, size_t l); - -void* pa_xmemdup(const void *p, size_t l); - -/** Internal helper for pa_xnew() */ -static inline void* pa_xnew_internal(unsigned n, size_t k) { - assert(n < INT_MAX/k); - return pa_xmalloc(n*k); -} - -/** Allocate n new structures of the specified type. */ -#define pa_xnew(type, n) ((type*) pa_xnew_internal((n), sizeof(type))) - -/** Internal helper for pa_xnew0() */ -static inline void* pa_xnew0_internal(unsigned n, size_t k) { - assert(n < INT_MAX/k); - return pa_xmalloc0(n*k); -} - -/** Same as pa_xnew() but set the memory to zero */ -#define pa_xnew0(type, n) ((type*) pa_xnew0_internal((n), sizeof(type))) - -#endif |