cosmetic fixes

This commit is contained in:
Loic Nageleisen 2013-02-01 21:09:34 +01:00
parent cda16d2a1b
commit e4bef3fbe0

23
main.c
View file

@ -1,15 +1,14 @@
/* /*
* Copyright © 2000 Loic Nageleisen <loic.nageleisen@gmail.com> * Copyright © 2000 Loic Nageleisen <loic.nageleisen@gmail.com>
* *
* This work is free. You can redistribute it and/or modify it under the * This work is free. You can redistribute it and/or modify it under the terms
* terms of the Do What The Fuck You Want To Public License, Version 2, * of the Do What The Fuck You Want To Public License, Version 2, as published
* as published by Sam Hocevar. See the COPYING file for more details. * by Sam Hocevar. See the COPYING file for more details.
* *
* This program is free software. It comes without any warranty, to * This program is free software. It comes without any warranty, to the extent
* the extent permitted by applicable law. You can redistribute it * permitted by applicable law. You can redistribute it and/or modify it under
* and/or modify it under the terms of the Do What The Fuck You Want * the terms of the Do What The Fuck You Want To Public License, Version 2, as
* To Public License, Version 2, as published by Sam Hocevar. See * published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
* http://www.wtfpl.net/ for more details.
* *
* --- * ---
* *
@ -59,6 +58,7 @@
#include <stdio.h> #include <stdio.h>
#include <Block.h> #include <Block.h>
struct Post_s { struct Post_s {
char *author; char *author;
char *body; char *body;
@ -69,11 +69,13 @@ struct Post_s {
}; };
typedef struct Post_s Post; typedef struct Post_s Post;
void Post_init(Post *self) { void Post_init(Post *self) {
*self->author = '\0'; *self->author = '\0';
*self->body = '\0'; *self->body = '\0';
} }
void Post_printf(Post *self) { void Post_printf(Post *self) {
char *nosp = NULL; char *nosp = NULL;
for (char *buf = self->body; *buf != '\0'; buf++) { for (char *buf = self->body; *buf != '\0'; buf++) {
@ -94,6 +96,7 @@ void Post_printf(Post *self) {
printf("\n\n-- %s\n", self->author); printf("\n\n-- %s\n", self->author);
} }
void Post_dealloc(Post *self) { void Post_dealloc(Post *self) {
Block_release(self->dealloc); Block_release(self->dealloc);
Block_release(self->printf); Block_release(self->printf);
@ -104,6 +107,7 @@ void Post_dealloc(Post *self) {
free(self); free(self);
} }
Post *Post_alloc() { Post *Post_alloc() {
Post *new = malloc(sizeof(Post)); Post *new = malloc(sizeof(Post));
new->author = malloc(255); new->author = malloc(255);
@ -116,6 +120,7 @@ Post *Post_alloc() {
return new; return new;
} }
int main(void) { int main(void) {
Post *post = Post_alloc(); Post *post = Post_alloc();
post->init(); post->init();