5252static struct hwinfo_pkg *
5353hwinfo_pkg_create (void )
5454{
55- struct hwinfo_pkg * pkg = malloc (sizeof (struct hwinfo_pkg ));
55+ struct hwinfo_pkg * pkg = ( struct hwinfo_pkg * ) malloc (sizeof (struct hwinfo_pkg ));
5656
5757 if (!pkg )
5858 return NULL ;
@@ -67,7 +67,7 @@ hwinfo_pkg_create(void)
6767static struct hwinfo_pkg *
6868hwinfo_pkg_dup (struct hwinfo_pkg * pkg )
6969{
70- struct hwinfo_pkg * pkgcpy = malloc (sizeof (struct hwinfo_pkg ));
70+ struct hwinfo_pkg * pkgcpy = ( struct hwinfo_pkg * ) malloc (sizeof (struct hwinfo_pkg ));
7171
7272 if (!pkgcpy )
7373 return NULL ;
@@ -92,7 +92,7 @@ static int
9292get_cpu_online_status (const char * cpu_dir )
9393{
9494 int status = 1 ;
95- char path [PATH_MAX ] = {0 };
95+ char path [PATH_MAX ] = {};
9696 FILE * f = NULL ;
9797 char buffer [2 ]; /* boolean expected */
9898
@@ -118,7 +118,7 @@ static char *
118118get_package_id (const char * cpu_dir )
119119{
120120 FILE * f = NULL ;
121- char path [PATH_MAX ] = {0 };
121+ char path [PATH_MAX ] = {};
122122 char buffer [24 ]; /* log10(ULLONG_MAX) */
123123 char * id = NULL ;
124124
@@ -138,7 +138,7 @@ get_package_id(const char *cpu_dir)
138138static char *
139139parse_cpu_id_from_name (const char * str )
140140{
141- regex_t re = {0 };
141+ regex_t re = {};
142142 regmatch_t matches [CPU_ID_REGEX_EXPECTED_MATCHES ];
143143 char * id = NULL ;
144144
@@ -191,7 +191,7 @@ do_packages_detection(struct hwinfo *hwinfo)
191191 }
192192
193193 /* get cpu pkg or create it if never encountered */
194- pkg = zhashx_lookup (hwinfo -> pkgs , pkg_id );
194+ pkg = ( struct hwinfo_pkg * ) zhashx_lookup (hwinfo -> pkgs , pkg_id );
195195 if (!pkg ) {
196196 pkg = hwinfo_pkg_create ();
197197 if (!pkg ) {
@@ -201,7 +201,7 @@ do_packages_detection(struct hwinfo *hwinfo)
201201
202202 zhashx_insert (hwinfo -> pkgs , pkg_id , pkg );
203203 hwinfo_pkg_destroy (& pkg );
204- pkg = zhashx_lookup (hwinfo -> pkgs , pkg_id ); /* get the copy the pkg done by zhashx_insert */
204+ pkg = ( struct hwinfo_pkg * ) zhashx_lookup (hwinfo -> pkgs , pkg_id ); /* get the copy the pkg done by zhashx_insert */
205205 }
206206
207207 zlistx_add_end (pkg -> cpus_id , cpu_id );
@@ -235,7 +235,7 @@ hwinfo_detect(struct hwinfo *hwinfo)
235235struct hwinfo *
236236hwinfo_create (void )
237237{
238- struct hwinfo * hw = malloc (sizeof (struct hwinfo ));
238+ struct hwinfo * hw = ( struct hwinfo * ) malloc (sizeof (struct hwinfo ));
239239
240240 if (!hw )
241241 return NULL ;
@@ -250,7 +250,7 @@ hwinfo_create(void)
250250struct hwinfo *
251251hwinfo_dup (struct hwinfo * hwinfo )
252252{
253- struct hwinfo * hwinfocpy = malloc (sizeof (struct hwinfo ));
253+ struct hwinfo * hwinfocpy = ( struct hwinfo * ) malloc (sizeof (struct hwinfo ));
254254
255255 if (!hwinfocpy )
256256 return NULL ;
0 commit comments