gril: Remove asserts

This commit is contained in:
Alfonso Sanchez-Beato 2015-10-15 18:46:58 +02:00 committed by Denis Kenzior
parent 7d428137e6
commit 88601c4733
3 changed files with 14 additions and 14 deletions

View File

@ -29,7 +29,6 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <sys/socket.h>
@ -358,14 +357,12 @@ static void io_disconnect(gpointer user_data)
static void handle_response(struct ril_s *p, struct ril_msg *message)
{
gsize count = g_queue_get_length(p->command_queue);
guint count = g_queue_get_length(p->command_queue);
struct ril_request *req;
gboolean found = FALSE;
guint i, len;
gint id;
g_assert(count > 0);
for (i = 0; i < count; i++) {
req = g_queue_peek_nth(p->command_queue, i);
@ -560,16 +557,20 @@ static struct ril_msg *read_fixed_record(struct ril_s *p,
bytes += 4;
/*
* TODO: Verify that 4k is the max message size from rild.
* TODO: Verify that 8k is the max message size from rild.
*
* These conditions shouldn't happen. If it does
* This condition shouldn't happen. If it does
* there are three options:
*
* 1) ASSERT; ofono will restart via DBus
* 1) Exit; ofono will restart via DBus (this is what we do now)
* 2) Consume the bytes & continue
* 3) force a disconnect
*/
g_assert(plen >= 8 && plen <= 4092);
if (plen > GRIL_BUFFER_SIZE - 4) {
ofono_error("ERROR RIL parcel bigger than buffer (%u), exiting",
plen);
exit(1);
}
/*
* If we don't have the whole fixed record in the ringbuffer
@ -580,13 +581,11 @@ static struct ril_msg *read_fixed_record(struct ril_s *p,
if (message_len < plen)
return NULL;
message = g_try_malloc(sizeof(struct ril_msg));
g_assert(message != NULL);
message = g_malloc(sizeof(struct ril_msg));
/* allocate ril_msg->buffer */
message->buf_len = plen;
message->buf = g_try_malloc(plen);
g_assert(message->buf != NULL);
message->buf = g_malloc(plen);
/* Copy bytes into message buffer */
memmove(message->buf, (const void *) bytes, plen);

View File

@ -27,7 +27,6 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@ -206,7 +205,7 @@ static GRilIO *create_io(GIOChannel *channel, GIOFlags flags)
io->use_write_watch = FALSE;
}
io->buf = ring_buffer_new(8192);
io->buf = ring_buffer_new(GRIL_BUFFER_SIZE);
if (!io->buf)
goto error;

View File

@ -29,6 +29,8 @@ extern "C" {
#include "gfunc.h"
#define GRIL_BUFFER_SIZE 8192
struct _GRilIO;
typedef struct _GRilIO GRilIO;