Browse Source

fixed segfault

master
mort 9 years ago
parent
commit
2603614f21
4 changed files with 11 additions and 2 deletions
  1. 3
    0
      src/cms_page.c
  2. 4
    0
      src/cms_post.c
  3. 1
    1
      src/cms_util.c
  4. 3
    1
      src/main.c

+ 3
- 0
src/cms_page.c View File

@@ -13,6 +13,9 @@
cms_page* cms_page_create()
{
cms_page* page = malloc(sizeof(cms_page));
page->_str = NULL;
page->title = NULL;
page->slug = NULL;
page->numposts = 0;
page->numsubs = 0;
page->posts = NULL;

+ 4
- 0
src/cms_post.c View File

@@ -10,6 +10,10 @@
cms_post* cms_post_create()
{
cms_post* post = malloc(sizeof(cms_post));
post->_str = NULL;
post->title = NULL;
post->slug = NULL;
post->html = NULL;
return post;
}


+ 1
- 1
src/cms_util.c View File

@@ -110,7 +110,7 @@ cms_err* cms_util_dir_copy_recursive(char* dir1, char* dir2)
if (st == NULL)
return cms_err_create(CMS_ERR_ALLOC, NULL);

while (ep = readdir(dp))
while ((ep = readdir(dp)) != NULL)
{
if (ep->d_name[0] == '.')
continue;

+ 3
- 1
src/main.c View File

@@ -11,12 +11,14 @@
//Temporary, for testing purposes
static void print_page_tree(cms_page* page)
{
printf("Page: %s\n", page->title);
if (page->title)
printf("Page: %s\n", page->title);

//Loop over posts
size_t i;
for (i = 0; i < page->numposts; ++i)
{
printf("printing post\n");
printf("\tPost: %s\n", (page->posts[i]).title);
}


Loading…
Cancel
Save