]> granicus.if.org Git - graphviz/commitdiff
squash warning in SparseMatrix_import_matrix_market/MATRIX_TYPE_COMPLEX
authorCosta Shulyupin <constantine.shulyupin@gmail.com>
Sun, 3 Apr 2022 08:10:41 +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 83db92fd7f17b9922e54e5f08804c5a4a343ce8c..5b74deec1ef48324181ab8e1bdb0e75418f1ce4d 100644 (file)
@@ -213,7 +213,9 @@ SparseMatrix SparseMatrix_import_matrix_market(FILE * f, int format)
            val = malloc(2 * nz * sizeof(double));
            v = val;
            for (i = 0; i < nz; i++) {
-               fscanf(f, "%d %d %lg %lg\n", &I[i], &J[i], &v[0], &v[1]);
+               int num = fscanf(f, "%d %d %lg %lg\n", &I[i], &J[i], &v[0], &v[1]);
+               (void)num;
+               assert(num == 4);
                v += 2;
                I[i]--;         /* adjust from 1-based to 0-based */
                J[i]--;