Print this page
5083 avoid undefined order of operations in assignments

*** 1781,1791 **** if (rb_head->state == SGHSC_RB_FULL) return (DDI_FAILURE); rb_head->buf[rb_head->put_idx] = *event; ! rb_head->put_idx = ++rb_head->put_idx & (rb_head->size - 1); if (rb_head->put_idx == rb_head->get_idx) rb_head->state = SGHSC_RB_FULL; else rb_head->state = SGHSC_RB_FLOAT; --- 1781,1791 ---- if (rb_head->state == SGHSC_RB_FULL) return (DDI_FAILURE); rb_head->buf[rb_head->put_idx] = *event; ! rb_head->put_idx = (rb_head->put_idx + 1) & (rb_head->size - 1); if (rb_head->put_idx == rb_head->get_idx) rb_head->state = SGHSC_RB_FULL; else rb_head->state = SGHSC_RB_FLOAT;
*** 1804,1814 **** if (rb_head->state == SGHSC_RB_EMPTY) return (DDI_FAILURE); *event = rb_head->buf[rb_head->get_idx]; ! rb_head->get_idx = ++rb_head->get_idx & (rb_head->size - 1); if (rb_head->get_idx == rb_head->put_idx) rb_head->state = SGHSC_RB_EMPTY; else rb_head->state = SGHSC_RB_FLOAT; --- 1804,1814 ---- if (rb_head->state == SGHSC_RB_EMPTY) return (DDI_FAILURE); *event = rb_head->buf[rb_head->get_idx]; ! rb_head->get_idx = (rb_head->get_idx + 1) & (rb_head->size - 1); if (rb_head->get_idx == rb_head->put_idx) rb_head->state = SGHSC_RB_EMPTY; else rb_head->state = SGHSC_RB_FLOAT;