@@ -870,19 +870,23 @@ static void terminate (tagFile *const file)
870
870
static tagResult readNext (tagFile * const file , tagEntry * const entry )
871
871
{
872
872
tagResult result ;
873
- if (file == NULL || ! file -> initialized )
873
+
874
+ if (file == NULL )
875
+ return TagFailure ;
876
+
877
+ if (! file -> initialized )
874
878
{
875
879
file -> err = TagErrnoInvalidArgument ;
876
- result = TagFailure ;
877
- }
878
- else if (! readTagLine (file , & file -> err ))
879
- result = TagFailure ;
880
- else
881
- {
882
- result = (entry != NULL )
883
- ? parseTagLine (file , entry , & file -> err )
884
- : TagSuccess ;
880
+ return TagFailure ;
885
881
}
882
+
883
+ if (! readTagLine (file , & file -> err ))
884
+ return TagFailure ;
885
+
886
+ result = (entry != NULL )
887
+ ? parseTagLine (file , entry , & file -> err )
888
+ : TagSuccess ;
889
+
886
890
return result ;
887
891
}
888
892
@@ -1034,7 +1038,10 @@ static tagResult findSequentialFull (tagFile *const file,
1034
1038
int (* isAcceptable ) (tagFile * const , void * ),
1035
1039
void * data )
1036
1040
{
1037
- if (file == NULL || !file -> initialized || file -> err )
1041
+ if (file == NULL || file -> err )
1042
+ return TagFailure ;
1043
+
1044
+ if (!file -> initialized )
1038
1045
{
1039
1046
file -> err = TagErrnoInvalidArgument ;
1040
1047
return TagFailure ;
@@ -1149,9 +1156,12 @@ static tagResult findNext (tagFile *const file, tagEntry *const entry)
1149
1156
1150
1157
static tagResult findPseudoTag (tagFile * const file , int rewindBeforeFinding , tagEntry * const entry )
1151
1158
{
1152
- if (file == NULL || (!file -> initialized ) || file -> err )
1159
+ if (file == NULL || file -> err )
1160
+ return TagFailure ;
1161
+
1162
+ if (!file -> initialized )
1153
1163
{
1154
- file -> err = TagErrnoInvalidArgument ; ;
1164
+ file -> err = TagErrnoInvalidArgument ;
1155
1165
return TagFailure ;
1156
1166
}
1157
1167
@@ -1182,7 +1192,10 @@ extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info)
1182
1192
1183
1193
extern tagResult tagsSetSortType (tagFile * const file , const tagSortType type )
1184
1194
{
1185
- if (file == NULL || (!file -> initialized ) || file -> err )
1195
+ if (file == NULL || file -> err )
1196
+ return TagFailure ;
1197
+
1198
+ if (!file -> initialized )
1186
1199
{
1187
1200
file -> err = TagErrnoInvalidArgument ;
1188
1201
return TagFailure ;
@@ -1203,7 +1216,10 @@ extern tagResult tagsSetSortType (tagFile *const file, const tagSortType type)
1203
1216
1204
1217
extern tagResult tagsFirst (tagFile * const file , tagEntry * const entry )
1205
1218
{
1206
- if (file == NULL || (!file -> initialized ) || file -> err )
1219
+ if (file == NULL || file -> err )
1220
+ return TagFailure ;
1221
+
1222
+ if (!file -> initialized )
1207
1223
{
1208
1224
file -> err = TagErrnoInvalidArgument ;
1209
1225
return TagFailure ;
@@ -1216,7 +1232,10 @@ extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry)
1216
1232
1217
1233
extern tagResult tagsNext (tagFile * const file , tagEntry * const entry )
1218
1234
{
1219
- if (file == NULL || (!file -> initialized ) || file -> err )
1235
+ if (file == NULL || file -> err )
1236
+ return TagFailure ;
1237
+
1238
+ if (!file -> initialized )
1220
1239
{
1221
1240
file -> err = TagErrnoInvalidArgument ;
1222
1241
return TagFailure ;
@@ -1236,21 +1255,29 @@ extern const char *tagsField (const tagEntry *const entry, const char *const key
1236
1255
extern tagResult tagsFind (tagFile * const file , tagEntry * const entry ,
1237
1256
const char * const name , const int options )
1238
1257
{
1239
- if (file == NULL || !file -> initialized || file -> err )
1258
+ if (file == NULL || file -> err )
1259
+ return TagFailure ;
1260
+
1261
+ if (!file -> initialized )
1240
1262
{
1241
1263
file -> err = TagErrnoInvalidArgument ;
1242
1264
return TagFailure ;
1243
1265
}
1266
+
1244
1267
return find (file , entry , name , options );
1245
1268
}
1246
1269
1247
1270
extern tagResult tagsFindNext (tagFile * const file , tagEntry * const entry )
1248
1271
{
1249
- if (file == NULL || !file -> initialized || file -> err )
1272
+ if (file == NULL || file -> err )
1273
+ return TagFailure ;
1274
+
1275
+ if (!file -> initialized )
1250
1276
{
1251
1277
file -> err = TagErrnoInvalidArgument ;
1252
1278
return TagFailure ;
1253
1279
}
1280
+
1254
1281
return findNext (file , entry );
1255
1282
}
1256
1283
0 commit comments