Commit 67f87db5 authored by Max Kellermann's avatar Max Kellermann

UpdateArchive: use std::string for temporary string

parent 7de96275
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "util/Error.hxx" #include "util/Error.hxx"
#include "Log.hxx" #include "Log.hxx"
#include <glib.h> #include <string>
#include <string.h> #include <string.h>
...@@ -42,14 +42,13 @@ update_archive_tree(Directory *directory, const char *name) ...@@ -42,14 +42,13 @@ update_archive_tree(Directory *directory, const char *name)
{ {
const char *tmp = strchr(name, '/'); const char *tmp = strchr(name, '/');
if (tmp) { if (tmp) {
char *child_name = g_strndup(name, tmp - name); const std::string child_name(name, tmp);
//add dir is not there already //add dir is not there already
db_lock(); db_lock();
Directory *subdir = Directory *subdir =
directory->MakeChild(child_name); directory->MakeChild(child_name.c_str());
subdir->device = DEVICE_INARCHIVE; subdir->device = DEVICE_INARCHIVE;
db_unlock(); db_unlock();
g_free(child_name);
//create directories first //create directories first
update_archive_tree(subdir, tmp+1); update_archive_tree(subdir, tmp+1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment