Coding style change

This commit is contained in:
Nils O. Selåsdal
2012-12-05 18:53:58 +01:00
parent d9c8b2b48a
commit 16e1ac52ec
32 changed files with 236 additions and 234 deletions
+6 -6
View File
@@ -27,7 +27,7 @@ uc_read_file(const char *f, size_t *length, size_t max)
}
if ((statb.st_mode & S_IFMT) == S_IFREG) {
if((size_t)statb.st_size > max) {
if ((size_t)statb.st_size > max) {
errno = EMSGSIZE;
goto out_close;
}
@@ -44,21 +44,21 @@ uc_read_file(const char *f, size_t *length, size_t max)
p = s;
for(;;) {
for (;;) {
ssize_t rc = read(fd, p, alloc_sz - (p - s));
if(rc == 0) {
if (rc == 0) {
*p = 0; // nul terminate. all malloc calls adds room for this byte
goto out_close;
} else if (rc == -1) {
goto out_err_free;
} else if(*length + rc > max) {
} else if (*length + rc > max) {
errno = EMSGSIZE;
goto out_err_free;
}
if(p + rc == s + alloc_sz) { //reached end of allocated memory, grow it.
if (p + rc == s + alloc_sz) { //reached end of allocated memory, grow it.
char *tmp = realloc(s, alloc_sz + CHUNK_SZ + 1);
if(tmp == NULL) {
if (tmp == NULL) {
goto out_err_free;
}