Skip to content

Commit 6a5a85a

Browse files
authored
maintenance: clean up some *.c (#6982)
* remove trailing spaces in code * remove unused includes
2 parents beede2a + fad0d19 commit 6a5a85a

3 files changed

Lines changed: 10 additions & 14 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ _coverage/
77
*.swp
88
compile_flags.txt
99
_opam
10+
**/*.[ch]~
11+
.zed/
1012

1113
# tests
1214
xapi-db.xml

ocaml/libs/xapi-stdext/lib/xapi-stdext-unix/blkgetsize_stubs.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@
1717
#include <sys/types.h>
1818
#include <sys/stat.h>
1919
#include <sys/ioctl.h>
20-
2120
#include <fcntl.h>
22-
#include <string.h>
2321
#include <unistd.h>
2422
#include <stdint.h>
25-
2623
#include "blkgetsize.h"
2724
#ifdef __linux__
2825
#include <linux/fs.h>

ocaml/libs/xapi-stdext/lib/xapi-stdext-unix/unixext_stubs.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,15 @@
1313
*/
1414
#include <sys/types.h>
1515
#include <sys/socket.h>
16-
#include <errno.h>
1716
#include <netinet/tcp.h>
1817
#include <netinet/in.h>
1918
#include <sys/un.h>
20-
#include <string.h>
2119
#include <unistd.h> /* needed for _SC_OPEN_MAX */
22-
#include <stdio.h> /* snprintf */
2320
#include <sys/ioctl.h>
2421
#include <sys/statvfs.h>
2522
#include <sys/sysmacros.h> /* needed for minor and major macros */
2623
#if defined(__linux__)
27-
# include <linux/fs.h>
24+
# include <linux/fs.h>
2825
#endif
2926

3027
#include <caml/mlvalues.h>
@@ -63,7 +60,7 @@ CAMLprim value stub_unixext_fsync (value fd)
6360
if (rc != 0) uerror("fsync", Nothing);
6461
CAMLreturn(Val_unit);
6562
}
66-
63+
6764

6865
CAMLprim value stub_unixext_blkgetsize64(value fd)
6966
{
@@ -106,12 +103,12 @@ CAMLprim value stub_unixext_set_sock_keepalives(value fd, value count, value idl
106103
int c_fd = Int_val(fd);
107104
int optval;
108105
socklen_t optlen=sizeof(optval);
109-
106+
110107
optval = Int_val(count);
111108
if(setsockopt(c_fd, TCP_LEVEL, TCP_KEEPCNT, &optval, optlen) < 0) {
112109
uerror("setsockopt(TCP_KEEPCNT)", Nothing);
113110
}
114-
#if defined(__linux__)
111+
#if defined(__linux__)
115112
optval = Int_val(idle);
116113
if(setsockopt(c_fd, TCP_LEVEL, TCP_KEEPIDLE, &optval, optlen) < 0) {
117114
uerror("setsockopt(TCP_KEEPIDLE)", Nothing);
@@ -137,7 +134,7 @@ void unixext_error(int code)
137134
caml_raise_with_arg(*exn, Val_int(code));
138135
}
139136

140-
CAMLprim value stub_statvfs(value filename)
137+
CAMLprim value stub_statvfs(value filename)
141138
{
142139
CAMLparam1(filename);
143140
CAMLlocal1(v);
@@ -178,7 +175,7 @@ CAMLprim value stub_makedev(value majo, value mino)
178175
long ret;
179176

180177
ret = makedev(Long_val(majo), Long_val(mino));
181-
178+
182179
CAMLreturn(Val_long(ret));
183180
}
184181

@@ -188,7 +185,7 @@ CAMLprim value stub_major(value dev)
188185
long ret;
189186

190187
ret = major(Long_val(dev));
191-
188+
192189
CAMLreturn(Val_long(ret));
193190
}
194191

@@ -198,6 +195,6 @@ CAMLprim value stub_minor(value dev)
198195
long ret;
199196

200197
ret = minor(Long_val(dev));
201-
198+
202199
CAMLreturn(Val_long(ret));
203200
}

0 commit comments

Comments
 (0)