Skip to content

Commit 3328a67

Browse files
KuzinAndreybvanassche
authored andcommitted
Fix: Unused variable warning in cpu_linux.c
mibgroup/hardware/cpu/cpu_linux.c: In function 'init_cpu_linux': mibgroup/hardware/cpu/cpu_linux.c:40:22: warning: unused variable 'cp' [-Wunused-variable] 40 | char buf[1024], *cp; | ^~ Move it to local scope.
1 parent 9c317cd commit 3328a67

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

agent/mibgroup/hardware/cpu/cpu_linux.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838
void init_cpu_linux( void ) {
3939
FILE *fp;
40-
char buf[1024], *cp;
40+
char buf[1024];
4141
int i, n = 0;
4242
netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
4343
strcpy(cpu->name, "Overall CPU statistics");
@@ -72,7 +72,7 @@ void init_cpu_linux( void ) {
7272

7373
#ifdef DESCR_FIELD
7474
if (!strncmp( buf, DESCR_FIELD, strlen(DESCR_FIELD))) {
75-
cp = strchr( buf, ':' );
75+
char *cp = strchr( buf, ':' );
7676
if (cp) {
7777
strlcpy(cpu->descr, cp + 2, sizeof(cpu->descr));
7878
cp = strchr(cpu->descr, '\n');
@@ -83,7 +83,7 @@ void init_cpu_linux( void ) {
8383
#endif
8484
#ifdef DESCR2_FIELD
8585
if (!strncmp( buf, DESCR2_FIELD, strlen(DESCR2_FIELD))) {
86-
cp = strchr( buf, ':' );
86+
char *cp = strchr( buf, ':' );
8787
if (cp) {
8888
strlcat(cpu->descr, cp, sizeof(cpu->descr));
8989
cp = strchr(cpu->descr, '\n');

0 commit comments

Comments
 (0)