UpdateArchive: use std::string for temporary string
This commit is contained in:
parent
7de96275dd
commit
67f87db511
@ -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)
|
|||||||
{
|
{
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user