directory: use GLib instead of utils.h
This commit is contained in:
parent
8cf9138541
commit
cc4e0a786d
@ -18,12 +18,13 @@
|
|||||||
|
|
||||||
#include "directory.h"
|
#include "directory.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "utils.h"
|
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <glib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
struct directory *
|
struct directory *
|
||||||
directory_new(const char *path, struct directory *parent)
|
directory_new(const char *path, struct directory *parent)
|
||||||
@ -34,8 +35,8 @@ directory_new(const char *path, struct directory *parent)
|
|||||||
assert(path != NULL);
|
assert(path != NULL);
|
||||||
assert((*path == 0) == (parent == NULL));
|
assert((*path == 0) == (parent == NULL));
|
||||||
|
|
||||||
directory = xcalloc(1, sizeof(*directory) -
|
directory = g_malloc0(sizeof(*directory) -
|
||||||
sizeof(directory->path) + pathlen + 1);
|
sizeof(directory->path) + pathlen + 1);
|
||||||
directory->parent = parent;
|
directory->parent = parent;
|
||||||
memcpy(directory->path, path, pathlen + 1);
|
memcpy(directory->path, path, pathlen + 1);
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ directory_get_directory(struct directory *directory, const char *name)
|
|||||||
if (isRootDirectory(name))
|
if (isRootDirectory(name))
|
||||||
return directory;
|
return directory;
|
||||||
|
|
||||||
duplicated = xstrdup(name);
|
duplicated = g_strdup(name);
|
||||||
locate = strchr(duplicated, '/');
|
locate = strchr(duplicated, '/');
|
||||||
while (1) {
|
while (1) {
|
||||||
if (locate)
|
if (locate)
|
||||||
|
Loading…
Reference in New Issue
Block a user