diff options
author | Alfred E. Heggestad <aeh@db.org> | 2015-06-16 21:49:43 +0200 |
---|---|---|
committer | Alfred E. Heggestad <aeh@db.org> | 2015-06-16 21:49:43 +0200 |
commit | 500a7d1de384e37d609476f84dce207cccf88dc2 (patch) | |
tree | 496ad61eb5d19117470fabcb8bdb62587a374769 /modules/rst | |
parent | 55fe148705d206d206f61dd9aa119a6672378e07 (diff) |
change ausrc/auplay base-class to pointer
- change from a memory-reference to a const pointer
- this saves one mem_deref() in the destructor and also
decreases the chance of introducing memory leaks
- test on debian
Diffstat (limited to 'modules/rst')
-rw-r--r-- | modules/rst/audio.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/rst/audio.c b/modules/rst/audio.c index 9fbfe26..2eca230 100644 --- a/modules/rst/audio.c +++ b/modules/rst/audio.c @@ -17,7 +17,7 @@ struct ausrc_st { - struct ausrc *as; + const struct ausrc *as; /* pointer to base-class (inheritance) */ pthread_t thread; struct rst *rst; mpg123_handle *mp3; @@ -52,7 +52,6 @@ static void destructor(void *arg) } mem_deref(st->aubuf); - mem_deref(st->as); } @@ -149,7 +148,7 @@ void rst_audio_feed(struct ausrc_st *st, const uint8_t *buf, size_t sz) } -static int alloc_handler(struct ausrc_st **stp, struct ausrc *as, +static int alloc_handler(struct ausrc_st **stp, const struct ausrc *as, struct media_ctx **ctx, struct ausrc_prm *prm, const char *dev, ausrc_read_h *rh, ausrc_error_h *errh, void *arg) @@ -164,7 +163,7 @@ static int alloc_handler(struct ausrc_st **stp, struct ausrc *as, if (!st) return ENOMEM; - st->as = mem_ref(as); + st->as = as; st->rh = rh; st->errh = errh; st->arg = arg; |