mirror of
https://github.com/pygos/pkg-utils.git
synced 2024-11-25 14:00:43 +01:00
David Oberhollenzer
be9bfed9b0
Mov file list from package function into seperate module, move declaration into new high-level header. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
37 lines
549 B
C
37 lines
549 B
C
#include <sys/stat.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
#include "image_entry.h"
|
|
#include "util.h"
|
|
|
|
void image_entry_free(image_entry_t *ent)
|
|
{
|
|
if (ent != NULL) {
|
|
switch (ent->mode & S_IFMT) {
|
|
case S_IFREG:
|
|
free(ent->data.file.location);
|
|
break;
|
|
case S_IFLNK:
|
|
free(ent->data.symlink.target);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
free(ent->name);
|
|
free(ent);
|
|
}
|
|
}
|
|
|
|
void image_entry_free_list(image_entry_t *list)
|
|
{
|
|
image_entry_t *ent;
|
|
|
|
while (list != NULL) {
|
|
ent = list;
|
|
list = list->next;
|
|
|
|
image_entry_free(ent);
|
|
}
|
|
}
|