]> granicus.if.org Git - graphviz/commitdiff
squash warning in SparseMatrix_import_matrix_market/MATRIX_TYPE_PATTERN
authorCosta Shulyupin <constantine.shulyupin@gmail.com>
Sun, 3 Apr 2022 08:10:29 +0000 (11:10 +0300)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 7 Apr 2022 15:28:22 +0000 (08:28 -0700)
warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]

On  success,  these functions return the number of input items
successfully matched and assigned; this can be fewer  than
provided  for,  or even zero, in the event of an early
matching failure.

cmd/tools/matrix_market.c

index 8803afb7c9ee9acf8173cfbcb7dad8879a20da3f..83db92fd7f17b9922e54e5f08804c5a4a343ce8c 100644 (file)
@@ -189,7 +189,9 @@ SparseMatrix SparseMatrix_import_matrix_market(FILE * f, int format)
            break;
        case MATRIX_TYPE_PATTERN:
            for (i = 0; i < nz; i++) {
-               fscanf(f, "%d %d\n", &I[i], &J[i]);
+               int num = fscanf(f, "%d %d\n", &I[i], &J[i]);
+               (void)num;
+               assert(num == 2);
                I[i]--;         /* adjust from 1-based to 0-based */
                J[i]--;
            }