return;
}
/* go through all row updates */
- for (int row_index = 0; row_index < YAJL_GET_OBJECT(jupdate)->len;
+ for (size_t row_index = 0; row_index < YAJL_GET_OBJECT(jupdate)->len;
++row_index) {
jrow_update = YAJL_GET_OBJECT(jupdate)->values[row_index];
/* go through all rows and get interface info */
jvalues = YAJL_GET_ARRAY(jresult)->values;
- for (int i = 0; i < YAJL_GET_ARRAY(jresult)->len; i++) {
+ for (size_t i = 0; i < YAJL_GET_ARRAY(jresult)->len; i++) {
jvalue = ovs_utils_get_value_by_key(jvalues[i], "rows");
if (jvalue == NULL || !YAJL_IS_ARRAY(jvalue)) {
ERROR(OVS_EVENTS_PLUGIN "invalid data (array of rows is expected)");
return;
}
/* get interfaces info */
- for (int j = 0; j < YAJL_GET_ARRAY(jvalue)->len; j++) {
+ for (size_t j = 0; j < YAJL_GET_ARRAY(jvalue)->len; j++) {
if (ovs_events_get_iface_info(YAJL_GET_ARRAY(jvalue)->values[j],
&ifinfo) < 0) {
ERROR(OVS_EVENTS_PLUGIN
array_len = YAJL_GET_ARRAY(jval)->len;
jvalues = YAJL_GET_ARRAY(jval)->values;
OVS_YAJL_CALL(yajl_gen_array_open, jgen);
- for (int i = 0; i < array_len; i++)
+ for (size_t i = 0; i < array_len; i++)
OVS_YAJL_CALL(ovs_yajl_gen_val, jgen, jvalues[i]);
OVS_YAJL_CALL(yajl_gen_array_close, jgen);
} else if (YAJL_IS_OBJECT(jval)) {
/* create new object and add all elements into the object */
OVS_YAJL_CALL(yajl_gen_map_open, jgen);
obj_len = YAJL_GET_OBJECT(jval)->len;
- for (int i = 0; i < obj_len; i++) {
+ for (size_t i = 0; i < obj_len; i++) {
obj_key = YAJL_GET_OBJECT(jval)->keys[i];
jobj_value = YAJL_GET_OBJECT(jval)->values[i];
OVS_YAJL_CALL(ovs_yajl_gen_tstring, jgen, obj_key);
char *json = NULL;
/* search open/close brace */
- for (int i = jreader->json_offset; i < jreader->buff_offset; i++) {
+ for (size_t i = jreader->json_offset; i < jreader->buff_offset; i++) {
if (jreader->buff_ptr[i] == '{') {
nbraces++;
} else if (jreader->buff_ptr[i] == '}')
* and zero rest of the buffer data */
json = &jreader->buff_ptr[jreader->json_offset];
json_len = jreader->buff_offset - jreader->json_offset;
- for (int i = 0; i < jreader->buff_size; i++)
+ for (size_t i = 0; i < jreader->buff_size; i++)
jreader->buff_ptr[i] = ((i < json_len) ? (json[i]) : (0));
jreader->buff_offset = json_len;
} else
/* Initialize EVENT thread */
static int ovs_db_event_thread_init(ovs_db_t *pdb) {
- pdb->event_thread.tid = -1;
+ pdb->event_thread.tid = (pthread_t)-1;
/* init event thread condition variable */
if (pthread_cond_init(&pdb->event_thread.cond, NULL)) {
return (-1);
/* Destroy EVENT thread */
static int ovs_db_event_thread_destroy(ovs_db_t *pdb) {
- if (pdb->event_thread.tid < 0)
+ if (pdb->event_thread.tid == (pthread_t)-1)
/* already destroyed */
return (0);
ovs_db_event_post(pdb, OVS_DB_EVENT_TERMINATE);
pthread_mutex_unlock(&pdb->event_thread.mutex);
pthread_mutex_destroy(&pdb->event_thread.mutex);
pthread_cond_destroy(&pdb->event_thread.cond);
- pdb->event_thread.tid = -1;
+ pdb->event_thread.tid = (pthread_t)-1;
return (0);
}
/* Initialize POLL thread */
static int ovs_db_poll_thread_init(ovs_db_t *pdb) {
- pdb->poll_thread.tid = -1;
+ pdb->poll_thread.tid = (pthread_t)-1;
/* init event thread mutex */
if (pthread_mutex_init(&pdb->poll_thread.mutex, NULL)) {
return (-1);
/* Destroy POLL thread */
static int ovs_db_poll_thread_destroy(ovs_db_t *pdb) {
- if (pdb->poll_thread.tid < 0)
+ if (pdb->poll_thread.tid == (pthread_t)-1)
/* already destroyed */
return (0);
/* change thread state */
if (pthread_join(pdb->poll_thread.tid, NULL) != 0)
return (-1);
pthread_mutex_destroy(&pdb->poll_thread.mutex);
- pdb->poll_thread.tid = -1;
+ pdb->poll_thread.tid = (pthread_t)-1;
return (0);
}
return NULL;
/* find a value by key */
- for (int i = 0; i < YAJL_GET_OBJECT(jval)->len; i++) {
+ for (size_t i = 0; i < YAJL_GET_OBJECT(jval)->len; i++) {
obj_key = YAJL_GET_OBJECT(jval)->keys[i];
if (strcmp(obj_key, key) == 0)
return YAJL_GET_OBJECT(jval)->values[i];
/* try to find map value by map key */
map_len = YAJL_GET_ARRAY(array_values[1])->len;
map_values = YAJL_GET_ARRAY(array_values[1])->values;
- for (int i = 0; i < map_len; i++) {
+ for (size_t i = 0; i < map_len; i++) {
/* check YAJL array */
if (!YAJL_IS_ARRAY(map_values[i]))
break;