From: Arnaud Giersch Date: Sun, 5 Mar 2023 16:35:16 +0000 (+0100) Subject: Sonar smells. X-Git-Tag: v3.34~371 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6924ac0d1c39cfc2ff29a21b3a32ba9378973b02 Sonar smells. --- diff --git a/examples/sthread/pthread-producer-consumer.c b/examples/sthread/pthread-producer-consumer.c index 8073105582..52a0080256 100644 --- a/examples/sthread/pthread-producer-consumer.c +++ b/examples/sthread/pthread-producer-consumer.c @@ -57,7 +57,7 @@ static void* consumer(void* id) int main(int argc, char** argv) { - char opt; + int opt; while ((opt = getopt(argc, argv, "c:C:p:P:q")) != -1) { switch (opt) { case 'q': @@ -75,7 +75,7 @@ int main(int argc, char** argv) case 'P': ProducerCount = atoi(optarg); break; - case '?': + default: /* '?' */ printf("unknown option: %c\n", optopt); break; } @@ -87,7 +87,7 @@ int main(int argc, char** argv) sem_init(&empty, 0, BufferSize); sem_init(&full, 0, 0); - int* ids = malloc(sizeof(int) * ((ProducerCount + ConsumerCount))); + int* ids = malloc(sizeof(int) * (ProducerCount + ConsumerCount)); for (int i = 0; i < ProducerCount + ConsumerCount; i++) ids[i] = i + 1; // The identity of each thread (for debug messages)