Avoid printf/puts

This commit is contained in:
twinaphex 2020-09-28 03:17:21 +02:00
parent 2e5bfd74ec
commit 783bcb7a61
3 changed files with 18 additions and 40 deletions

View File

@ -15,7 +15,6 @@
#include <stdint.h> #include <stdint.h>
#include <malloc.h> #include <malloc.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <kernel.h> #include <kernel.h>
@ -45,12 +44,6 @@ static void audioConfigure(ps2_audio_t *ps2, unsigned rate)
err = audsrv_set_format(&format); 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); audsrv_set_volume(MAX_VOLUME);
} }

View File

@ -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) static int pcm_mmap_commit(struct pcm *pcm, unsigned int offset, unsigned int frames)
{ {
int ret; int ret;
/* not used */ /* not used */
(void) offset; (void) offset;
/* update the application pointer in userspace and kernel */ /* update the application pointer in userspace and kernel */
pcm_mmap_appl_forward(pcm, frames); pcm_mmap_appl_forward(pcm, frames);
ret = pcm_sync_ptr(pcm, 0); ret = pcm_sync_ptr(pcm, 0);
if (ret != 0) if (ret != 0)
{ return ret;
printf("%d\n", ret);
return ret;
}
return frames; return frames;
} }
static void pcm_mmap_appl_forward(struct pcm *pcm, int frames) static void pcm_mmap_appl_forward(struct pcm *pcm, int frames)

View File

@ -20,7 +20,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef _WIN32 #ifdef _WIN32
#include <direct.h> #include <direct.h>
@ -506,39 +505,29 @@ int libretrodb_create_index(libretrodb_t *db,
while (libretrodb_cursor_read_item(&cur, &item) == 0) while (libretrodb_cursor_read_item(&cur, &item) == 0)
{ {
/* Only map keys are supported */
if (item.type != RDT_MAP) if (item.type != RDT_MAP)
{
printf("Only map keys are supported\n");
goto clean; goto clean;
}
field = rmsgpack_dom_value_map_value(&item, &key); field = rmsgpack_dom_value_map_value(&item, &key);
/* Field not found in item */
if (!field) if (!field)
{
printf("field not found in item\n");
goto clean; goto clean;
}
/* Field is not binary */
if (field->type != RDT_BINARY) if (field->type != RDT_BINARY)
{
printf("field is not binary\n");
goto clean; goto clean;
}
/* Field is empty */
if (field->val.binary.len == 0) if (field->val.binary.len == 0)
{
printf("field is empty\n");
goto clean; goto clean;
}
if (field_size == 0) if (field_size == 0)
field_size = field->val.binary.len; field_size = field->val.binary.len;
/* Field is not of correct size */
else if (field->val.binary.len != field_size) else if (field->val.binary.len != field_size)
{
printf("field is not of correct size\n");
goto clean; goto clean;
}
buff = malloc(field_size + sizeof(uint64_t)); buff = malloc(field_size + sizeof(uint64_t));
if (!buff) if (!buff)
@ -550,11 +539,10 @@ int libretrodb_create_index(libretrodb_t *db,
memcpy(buff_u64, &item_loc, sizeof(uint64_t)); memcpy(buff_u64, &item_loc, sizeof(uint64_t));
/* Value is not unique? */
if (bintree_insert(tree, buff) != 0) if (bintree_insert(tree, buff) != 0)
{ {
printf("Value is not unique: ");
rmsgpack_dom_value_print(field); rmsgpack_dom_value_print(field);
printf("\n");
goto clean; goto clean;
} }
buff = NULL; buff = NULL;
@ -571,8 +559,8 @@ int libretrodb_create_index(libretrodb_t *db,
idx.next = db->count * (field_size + sizeof(uint64_t)); idx.next = db->count * (field_size + sizeof(uint64_t));
libretrodb_write_index_header(db->fd, &idx); libretrodb_write_index_header(db->fd, &idx);
nictx.db = db; nictx.db = db;
nictx.idx = &idx; nictx.idx = &idx;
bintree_iterate(tree, node_iter, &nictx); bintree_iterate(tree, node_iter, &nictx);
clean: clean: