From 783bcb7a61b7c6957313135910758225082c2507 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 28 Sep 2020 03:17:21 +0200 Subject: [PATCH] Avoid printf/puts --- audio/drivers/ps2_audio.c | 7 ------- audio/drivers/tinyalsa.c | 21 +++++++++------------ libretro-db/libretrodb.c | 30 +++++++++--------------------- 3 files changed, 18 insertions(+), 40 deletions(-) diff --git a/audio/drivers/ps2_audio.c b/audio/drivers/ps2_audio.c index 87aef95c8f..080f2b708c 100644 --- a/audio/drivers/ps2_audio.c +++ b/audio/drivers/ps2_audio.c @@ -15,7 +15,6 @@ #include #include -#include #include #include @@ -45,12 +44,6 @@ static void audioConfigure(ps2_audio_t *ps2, unsigned rate) err = audsrv_set_format(&format); - if (err) - { - printf("set format returned %d\n", err); - printf("audsrv returned error string: %s\n", audsrv_get_error_string()); - } - audsrv_set_volume(MAX_VOLUME); } diff --git a/audio/drivers/tinyalsa.c b/audio/drivers/tinyalsa.c index 81ffdcaac8..952b35899d 100644 --- a/audio/drivers/tinyalsa.c +++ b/audio/drivers/tinyalsa.c @@ -1208,21 +1208,18 @@ static int pcm_mmap_begin(struct pcm *pcm, void **areas, unsigned int *offset, static int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames) { - int ret; + int ret; - /* not used */ - (void) offset; + /* not used */ + (void) offset; - /* update the application pointer in userspace and kernel */ - pcm_mmap_appl_forward(pcm, frames); - ret = pcm_sync_ptr(pcm, 0); - if (ret != 0) - { - printf("%d\n", ret); - return ret; - } + /* update the application pointer in userspace and kernel */ + pcm_mmap_appl_forward(pcm, frames); + ret = pcm_sync_ptr(pcm, 0); + if (ret != 0) + return ret; - return frames; + return frames; } static void pcm_mmap_appl_forward(struct pcm *pcm, int frames) diff --git a/libretro-db/libretrodb.c b/libretro-db/libretrodb.c index 266e0affd8..3568ff08a1 100644 --- a/libretro-db/libretrodb.c +++ b/libretro-db/libretrodb.c @@ -20,7 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include #include #ifdef _WIN32 #include @@ -506,39 +505,29 @@ int libretrodb_create_index(libretrodb_t *db, while (libretrodb_cursor_read_item(&cur, &item) == 0) { + /* Only map keys are supported */ if (item.type != RDT_MAP) - { - printf("Only map keys are supported\n"); goto clean; - } field = rmsgpack_dom_value_map_value(&item, &key); + /* Field not found in item */ if (!field) - { - printf("field not found in item\n"); goto clean; - } + /* Field is not binary */ if (field->type != RDT_BINARY) - { - printf("field is not binary\n"); goto clean; - } + /* Field is empty */ if (field->val.binary.len == 0) - { - printf("field is empty\n"); goto clean; - } if (field_size == 0) field_size = field->val.binary.len; - else if (field->val.binary.len != field_size) - { - printf("field is not of correct size\n"); + /* Field is not of correct size */ + else if (field->val.binary.len != field_size) goto clean; - } buff = malloc(field_size + sizeof(uint64_t)); if (!buff) @@ -550,11 +539,10 @@ int libretrodb_create_index(libretrodb_t *db, memcpy(buff_u64, &item_loc, sizeof(uint64_t)); + /* Value is not unique? */ if (bintree_insert(tree, buff) != 0) { - printf("Value is not unique: "); rmsgpack_dom_value_print(field); - printf("\n"); goto clean; } buff = NULL; @@ -571,8 +559,8 @@ int libretrodb_create_index(libretrodb_t *db, idx.next = db->count * (field_size + sizeof(uint64_t)); libretrodb_write_index_header(db->fd, &idx); - nictx.db = db; - nictx.idx = &idx; + nictx.db = db; + nictx.idx = &idx; bintree_iterate(tree, node_iter, &nictx); clean: