Skip to content

Commit e96e54f

Browse files
committed
Minor style changes.
1 parent 66e14ae commit e96e54f

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

libyara/proc/linux.c

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2007-2017. The YARA Authors. All Rights Reserved.
2+
Copyright (c) 2007-2021. The YARA Authors. All Rights Reserved.
33
44
Redistribution and use in source and binary forms, with or without modification,
55
are permitted provided that the following conditions are met:
@@ -40,15 +40,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4040
#include <yara/mem.h>
4141
#include <yara/proc.h>
4242

43-
4443
typedef struct _YR_PROC_INFO
4544
{
4645
int pid;
4746
int mem_fd;
4847
FILE* maps;
4948
} YR_PROC_INFO;
5049

51-
5250
int _yr_process_attach(int pid, YR_PROC_ITERATOR_CTX* context)
5351
{
5452
char buffer[256];
@@ -89,7 +87,6 @@ int _yr_process_attach(int pid, YR_PROC_ITERATOR_CTX* context)
8987
return ERROR_SUCCESS;
9088
}
9189

92-
9390
int _yr_process_detach(YR_PROC_ITERATOR_CTX* context)
9491
{
9592
YR_PROC_INFO* proc_info = (YR_PROC_INFO*) context->proc_info;
@@ -100,7 +97,6 @@ int _yr_process_detach(YR_PROC_ITERATOR_CTX* context)
10097
return ERROR_SUCCESS;
10198
}
10299

103-
104100
YR_API const uint8_t* yr_process_fetch_memory_block_data(YR_MEMORY_BLOCK* block)
105101
{
106102
const uint8_t* result = NULL;
@@ -144,7 +140,6 @@ _exit:;
144140
return result;
145141
}
146142

147-
148143
YR_API YR_MEMORY_BLOCK* yr_process_get_next_memory_block(
149144
YR_MEMORY_BLOCK_ITERATOR* iterator)
150145
{
@@ -154,7 +149,6 @@ YR_API YR_MEMORY_BLOCK* yr_process_get_next_memory_block(
154149

155150
char buffer[256];
156151
uint64_t begin, end;
157-
int c;
158152

159153
if (fgets(buffer, sizeof(buffer), proc_info->maps) != NULL)
160154
{
@@ -164,11 +158,12 @@ YR_API YR_MEMORY_BLOCK* yr_process_get_next_memory_block(
164158
context->current_block.size = end - begin;
165159
result = &context->current_block;
166160
}
167-
/* if we haven't read the whole line, skip over the rest */
161+
162+
// If we haven't read the whole line, skip over the rest.
168163
if (strrchr(buffer, '\n') == NULL)
169164
do
170165
{
171-
c = fgetc(proc_info->maps);
166+
int c = fgetc(proc_info->maps);
172167
} while (c >= 0 && c != '\n');
173168

174169
iterator->last_error = ERROR_SUCCESS;
@@ -185,7 +180,6 @@ YR_API YR_MEMORY_BLOCK* yr_process_get_next_memory_block(
185180
return result;
186181
}
187182

188-
189183
YR_API YR_MEMORY_BLOCK* yr_process_get_first_memory_block(
190184
YR_MEMORY_BLOCK_ITERATOR* iterator)
191185
{
@@ -205,12 +199,7 @@ YR_API YR_MEMORY_BLOCK* yr_process_get_first_memory_block(
205199

206200
_exit:
207201

208-
YR_DEBUG_FPRINTF(
209-
2,
210-
stderr,
211-
"} = %p // %s()\n",
212-
result,
213-
__FUNCTION__);
202+
YR_DEBUG_FPRINTF(2, stderr, "} = %p // %s()\n", result, __FUNCTION__);
214203

215204
return result;
216205
}

0 commit comments

Comments
 (0)