Commit e1cc6419 authored by Tom Lane's avatar Tom Lane

Remove some useless assignments of the result of fread(). Quiets warnings

from clang static checker, and makes the code more readable anyway IMO.
parent dd6de24e
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.289 2009/08/12 20:53:30 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.290 2009/08/30 17:18:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -3502,7 +3502,8 @@ load_relcache_init_file(bool shared) ...@@ -3502,7 +3502,8 @@ load_relcache_init_file(bool shared)
bool has_not_null; bool has_not_null;
/* first read the relation descriptor length */ /* first read the relation descriptor length */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) nread = fread(&len, 1, sizeof(len), fp);
if (nread != sizeof(len))
{ {
if (nread == 0) if (nread == 0)
break; /* end of file */ break; /* end of file */
...@@ -3523,15 +3524,15 @@ load_relcache_init_file(bool shared) ...@@ -3523,15 +3524,15 @@ load_relcache_init_file(bool shared)
rel = rels[num_rels++] = (Relation) palloc(len); rel = rels[num_rels++] = (Relation) palloc(len);
/* then, read the Relation structure */ /* then, read the Relation structure */
if ((nread = fread(rel, 1, len, fp)) != len) if (fread(rel, 1, len, fp) != len)
goto read_failed; goto read_failed;
/* next read the relation tuple form */ /* next read the relation tuple form */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
relform = (Form_pg_class) palloc(len); relform = (Form_pg_class) palloc(len);
if ((nread = fread(relform, 1, len, fp)) != len) if (fread(relform, 1, len, fp) != len)
goto read_failed; goto read_failed;
rel->rd_rel = relform; rel->rd_rel = relform;
...@@ -3548,23 +3549,23 @@ load_relcache_init_file(bool shared) ...@@ -3548,23 +3549,23 @@ load_relcache_init_file(bool shared)
has_not_null = false; has_not_null = false;
for (i = 0; i < relform->relnatts; i++) for (i = 0; i < relform->relnatts; i++)
{ {
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
if (len != ATTRIBUTE_FIXED_PART_SIZE) if (len != ATTRIBUTE_FIXED_PART_SIZE)
goto read_failed; goto read_failed;
if ((nread = fread(rel->rd_att->attrs[i], 1, len, fp)) != len) if (fread(rel->rd_att->attrs[i], 1, len, fp) != len)
goto read_failed; goto read_failed;
has_not_null |= rel->rd_att->attrs[i]->attnotnull; has_not_null |= rel->rd_att->attrs[i]->attnotnull;
} }
/* next read the access method specific field */ /* next read the access method specific field */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
if (len > 0) if (len > 0)
{ {
rel->rd_options = palloc(len); rel->rd_options = palloc(len);
if ((nread = fread(rel->rd_options, 1, len, fp)) != len) if (fread(rel->rd_options, 1, len, fp) != len)
goto read_failed; goto read_failed;
if (len != VARSIZE(rel->rd_options)) if (len != VARSIZE(rel->rd_options))
goto read_failed; /* sanity check */ goto read_failed; /* sanity check */
...@@ -3600,11 +3601,11 @@ load_relcache_init_file(bool shared) ...@@ -3600,11 +3601,11 @@ load_relcache_init_file(bool shared)
nailed_indexes++; nailed_indexes++;
/* next, read the pg_index tuple */ /* next, read the pg_index tuple */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
rel->rd_indextuple = (HeapTuple) palloc(len); rel->rd_indextuple = (HeapTuple) palloc(len);
if ((nread = fread(rel->rd_indextuple, 1, len, fp)) != len) if (fread(rel->rd_indextuple, 1, len, fp) != len)
goto read_failed; goto read_failed;
/* Fix up internal pointers in the tuple -- see heap_copytuple */ /* Fix up internal pointers in the tuple -- see heap_copytuple */
...@@ -3612,11 +3613,11 @@ load_relcache_init_file(bool shared) ...@@ -3612,11 +3613,11 @@ load_relcache_init_file(bool shared)
rel->rd_index = (Form_pg_index) GETSTRUCT(rel->rd_indextuple); rel->rd_index = (Form_pg_index) GETSTRUCT(rel->rd_indextuple);
/* next, read the access method tuple form */ /* next, read the access method tuple form */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
am = (Form_pg_am) palloc(len); am = (Form_pg_am) palloc(len);
if ((nread = fread(am, 1, len, fp)) != len) if (fread(am, 1, len, fp) != len)
goto read_failed; goto read_failed;
rel->rd_am = am; rel->rd_am = am;
...@@ -3632,50 +3633,50 @@ load_relcache_init_file(bool shared) ...@@ -3632,50 +3633,50 @@ load_relcache_init_file(bool shared)
rel->rd_indexcxt = indexcxt; rel->rd_indexcxt = indexcxt;
/* next, read the vector of opfamily OIDs */ /* next, read the vector of opfamily OIDs */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
opfamily = (Oid *) MemoryContextAlloc(indexcxt, len); opfamily = (Oid *) MemoryContextAlloc(indexcxt, len);
if ((nread = fread(opfamily, 1, len, fp)) != len) if (fread(opfamily, 1, len, fp) != len)
goto read_failed; goto read_failed;
rel->rd_opfamily = opfamily; rel->rd_opfamily = opfamily;
/* next, read the vector of opcintype OIDs */ /* next, read the vector of opcintype OIDs */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
opcintype = (Oid *) MemoryContextAlloc(indexcxt, len); opcintype = (Oid *) MemoryContextAlloc(indexcxt, len);
if ((nread = fread(opcintype, 1, len, fp)) != len) if (fread(opcintype, 1, len, fp) != len)
goto read_failed; goto read_failed;
rel->rd_opcintype = opcintype; rel->rd_opcintype = opcintype;
/* next, read the vector of operator OIDs */ /* next, read the vector of operator OIDs */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
operator = (Oid *) MemoryContextAlloc(indexcxt, len); operator = (Oid *) MemoryContextAlloc(indexcxt, len);
if ((nread = fread(operator, 1, len, fp)) != len) if (fread(operator, 1, len, fp) != len)
goto read_failed; goto read_failed;
rel->rd_operator = operator; rel->rd_operator = operator;
/* next, read the vector of support procedures */ /* next, read the vector of support procedures */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
support = (RegProcedure *) MemoryContextAlloc(indexcxt, len); support = (RegProcedure *) MemoryContextAlloc(indexcxt, len);
if ((nread = fread(support, 1, len, fp)) != len) if (fread(support, 1, len, fp) != len)
goto read_failed; goto read_failed;
rel->rd_support = support; rel->rd_support = support;
/* finally, read the vector of indoption values */ /* finally, read the vector of indoption values */
if ((nread = fread(&len, 1, sizeof(len), fp)) != sizeof(len)) if (fread(&len, 1, sizeof(len), fp) != sizeof(len))
goto read_failed; goto read_failed;
indoption = (int16 *) MemoryContextAlloc(indexcxt, len); indoption = (int16 *) MemoryContextAlloc(indexcxt, len);
if ((nread = fread(indoption, 1, len, fp)) != len) if (fread(indoption, 1, len, fp) != len)
goto read_failed; goto read_failed;
rel->rd_indoption = indoption; rel->rd_indoption = indoption;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment