[RISC-V] Avoid unnecessary extensions when value is already extended
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / rhbz1878600.c
blob9f6ccb6dc275922a49dfb15687c414f5dc477799
1 #include <stdio.h>
3 #define INI_MAX_LINE 200
5 typedef char* (*ini_reader)(char* str, int num, void* stream);
7 int ini_parse(const char* filename);
9 static int ini_parse_stream(ini_reader reader, void* stream)
11 char line[INI_MAX_LINE];
12 int max_line = INI_MAX_LINE;
13 while (reader(line, max_line, stream) != NULL)
15 return 0;
18 static int ini_parse_file(FILE* file)
20 return ini_parse_stream((ini_reader)fgets, file);
23 int ini_parse(const char* filename)
25 FILE* file;
26 int error;
28 file = fopen(filename, "r");
29 if (!file)
30 return -1;
31 error = ini_parse_file(file);
32 fclose(file);
33 return error;