sockutils: apply w indentation
@@ -36,13 +36,15 @@ gftp_get_line (gftp_request * request, gftp_getline_buffer ** rbuf,
ssize_t ret;
gftp_getline_buffer * rrbuf; // = *rbuf (avoid too many (*rbuf)->)
- if (request == NULL || request->read_function == NULL)
+ if (request == NULL || request->read_function == NULL) {
read_function = gftp_fd_read;
- else
+ } else {
read_function = request->read_function;
+ }
if (*rbuf == NULL)
{
+ // initialize buffer and default values for the struct
*rbuf = g_malloc0 (sizeof (**rbuf));
rrbuf = *rbuf;
rrbuf->max_bufsize = len;
@@ -50,6 +52,7 @@ gftp_get_line (gftp_request * request, gftp_getline_buffer ** rbuf,
ret = read_function (request, rrbuf->buffer, rrbuf->max_bufsize, fd);
if (ret <= 0) {
+ // nothing was retrieved from the socket
gftp_free_getline_buffer (rbuf);
return (ret);
}
@@ -57,7 +60,11 @@ gftp_get_line (gftp_request * request, gftp_getline_buffer ** rbuf,
rrbuf->cur_bufsize = ret;
rrbuf->curpos = rrbuf->buffer;
}
- else rrbuf = *rbuf;
+ else
+ {
+ // buffer already created, use a variable that is more readable
+ rrbuf = *rbuf;
+ }
//g_return_val_if_fail (rrbuf->curpos != NULL, GFTP_EFATAL);
@@ -339,8 +346,8 @@ gftp_writefmt (gftp_request * request, int fd, const char *fmt, ...)
return (ret);
}
-int
-gftp_fd_get_sockblocking (gftp_request * request, int fd)
+
+int gftp_fd_get_sockblocking (gftp_request * request, int fd)
{
int flags;
@@ -358,8 +365,8 @@ gftp_fd_get_sockblocking (gftp_request * request, int fd)
return (flags & O_NONBLOCK) != 0;
}
-int
-gftp_fd_set_sockblocking (gftp_request * request, int fd, int non_blocking)
+
+int gftp_fd_set_sockblocking (gftp_request * request, int fd, int non_blocking)
{
#ifndef __APPLE__
int flags;
