Commit e46eb634 authored by Scott Vokes's avatar Scott Vokes
Browse files

Fix warnings related to unused vars and signed/unsigned comparisons.

parent b397f626
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -291,8 +291,7 @@ static bool poll_on_completion(struct bus *b, int fd) {
                if (msec > 0) {
                    BUS_LOG_SNPRINTF(b, 5, LOG_SENDING_REQUEST, b->udata, 64,
                        " -- backpressure of %d msec", msec);
                    usleep(1000L * msec);
                    //(void)poll(fds, 0, msec);
                    (void)poll(fds, 0, msec);
                }
                BUS_LOG(b, 3, LOG_SENDING_REQUEST, "sent!", b->udata);
                return true;
+3 −0
Original line number Diff line number Diff line
@@ -370,6 +370,9 @@ static void completion_cb(bus_msg_result_t *res, void *udata) {
                break;
            }
        }
#else
        (void)s;
        (void)si;
#endif
    }
    break;
+3 −1
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ struct listener *listener_init(struct bus *b, struct bus_config *cfg) {
    }
    l->msg_freelist = &l->msgs[0];

    (void)cfg;
    return l;
}

@@ -178,6 +179,7 @@ static void free_queue_cb(void *data, void *udata) {
    default:
        break;
    }
    (void)udata;
}

void listener_free(struct listener *l) {
@@ -456,7 +458,7 @@ static void process_unpacked_message(listener *l,
         * could in the unpack_cb above. */
        b->error_cb(result, ci->udata);
    }
};
}

static void tick_handler(listener *l) {
    struct bus *b = l->bus;
+1 −0
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ struct sender *sender_init(struct bus *b, struct bus_config *cfg) {

    BUS_LOG(b, 2, LOG_SENDER, "init success", b->udata);

    (void)cfg;
    return s;
}

+12 −12
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ struct yacht *yacht_init(uint8_t sz2) {
        y->size = size;
        y->mask = size - 1;
        LOG(" -- init with size %zd\n", size);
        for (int i = 0; i < size; i++) {
        for (size_t i = 0; i < size; i++) {
            y->buckets[i] = YACHT_NO_KEY;
        }
        return y;
@@ -60,17 +60,17 @@ static int hash(int key) {

/* Check if KEY is in the table. */
bool yacht_member(struct yacht *y, int key) {
    int b = hash(key) & y->mask;
    size_t b = hash(key) & y->mask;
    LOG(" -- checking membership for %d with bucket %d\n", key, b);

    for (int i = b; i < y->size; i++) {
    for (size_t i = b; i < y->size; i++) {
        int bv = y->buckets[i];
        LOG(" -- b %d: %d\n", i, bv);
        if (bv == key) { return true; }
        if (bv == YACHT_NO_KEY) { return false; }
    }

    for (int i = 0; i < b; i++) { /* wrap, if necessary */
    for (size_t i = 0; i < b; i++) { /* wrap, if necessary */
        int bv = y->buckets[i];
        LOG(" -- b %d: %d\n", i, bv);
        if (bv == key) { return true; }
@@ -82,10 +82,10 @@ bool yacht_member(struct yacht *y, int key) {

/* Add KEY to the table. */
bool yacht_add(struct yacht *y, int key) {
    int b = hash(key) & y->mask;
    size_t b = hash(key) & y->mask;
    LOG(" -- adding %d with bucket %d\n", key, b);

    for (int i = b; i < y->size; i++) {
    for (size_t i = b; i < y->size; i++) {
        int bv = y->buckets[i];
        LOG(" -- b %d: %d\n", i, bv);
        if (bv == key) {
@@ -95,7 +95,7 @@ bool yacht_add(struct yacht *y, int key) {
            return true;
        } else {
            /* Brent's variation -- bump out key if not in its main spot  */
            int oh = hash(bv) & y->mask;
            size_t oh = hash(bv) & y->mask;
            if (oh != i) {
                y->buckets[i] = key;
                key = oh;
@@ -103,7 +103,7 @@ bool yacht_add(struct yacht *y, int key) {
        }
    }

    for (int i = 0; i < b; i++) { /* wrap, if necessary */
    for (size_t i = 0; i < b; i++) { /* wrap, if necessary */
        int bv = y->buckets[i];
        LOG(" -- b %d: %d\n", i, bv);
        if (bv == key) {
@@ -113,7 +113,7 @@ bool yacht_add(struct yacht *y, int key) {
            return true;
        } else {
            /* Brent's variation -- bump out key if not in its main spot  */
            int oh = hash(bv) & y->mask;
            size_t oh = hash(bv) & y->mask;
            if (oh != i) {
                y->buckets[i] = key;
                key = oh;
@@ -126,10 +126,10 @@ bool yacht_add(struct yacht *y, int key) {

/* Remove KEY from the table. */
bool yacht_remove(struct yacht *y, int key) {
    int b = hash(key) & y->mask;
    size_t b = hash(key) & y->mask;
    LOG(" -- removing %d with bucket %d\n", key, b);

    for (int i = b; i < y->size; i++) {
    for (size_t i = b; i < y->size; i++) {
        int bv = y->buckets[i];
        LOG(" -- b %d: %d\n", i, bv);
        if (bv == key) {
@@ -144,7 +144,7 @@ bool yacht_remove(struct yacht *y, int key) {
        }
    }

    for (int i = 0; i < b; i++) { /* wrap, if necessary */
    for (size_t i = 0; i < b; i++) { /* wrap, if necessary */
        int bv = y->buckets[i];
        LOG(" -- b %d: %d\n", i, bv);
        if (bv == key) {