Skip to content

Commit a4f0896

Browse files
committed
Reduce/remove scope of variables
1 parent 87769de commit a4f0896

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/fsclient.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,12 @@
212212

213213
}
214214

215-
int fsclient_devlist(void) { int result = 0;
215+
int fsclient_devlist(void) {
216216
int loop0, devcount; char devlist[256], *temp = devlist;
217217

218218
// Get the device listing.
219219
devcount = ps2netfs_command_devlist("", 0, devlist);
220-
if (devcount < 0) { printf("Error: Get device listing failed. (%d)\n", result); return -1; }
220+
if (devcount < 0) { printf("Error: Get device listing failed. (%d)\n", devcount); return -1; }
221221

222222
// Output the display header.
223223
printf("\n [Active Devices]\n\n");

src/ps2link.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,13 @@
326326

327327
int ps2link_request_read(void *packet) {
328328
struct { unsigned int number; unsigned short length; int fd; int size; } PACKED *request = packet;
329-
int result = -1, size = -1; char buffer[65536], *bigbuffer;
329+
int result = -1, size = -1; char buffer[65536];
330330

331331
// If a big read is requested...
332332
if (ntohl(request->size) > sizeof(buffer)) {
333333

334334
// Allocate the bigbuffer.
335-
bigbuffer = malloc(ntohl(request->size));
335+
char *bigbuffer = malloc(ntohl(request->size));
336336

337337
// Perform the request.
338338
result = size = read(ntohl(request->fd), bigbuffer, ntohl(request->size));
@@ -367,13 +367,13 @@
367367

368368
int ps2link_request_write(void *packet) {
369369
struct { unsigned int number; unsigned short length; int fd; int size; } PACKED *request = packet;
370-
int result = -1; char buffer[65536], *bigbuffer;
370+
int result = -1; char buffer[65536];
371371

372372
// If a big write is requested...
373373
if (ntohl(request->size) > sizeof(buffer)) {
374374

375375
// Allocate the bigbuffer.
376-
bigbuffer = malloc(ntohl(request->size));
376+
char *bigbuffer = malloc(ntohl(request->size));
377377

378378
// Read the request data.
379379
network_receive_all(request_socket, bigbuffer, ntohl(request->size));

0 commit comments

Comments
 (0)