io: path: use new to_string() and b_string apis
This commit is contained in:
@@ -18,7 +18,7 @@ struct b_path {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void path_release(struct b_object *obj);
|
static void path_release(struct b_object *obj);
|
||||||
static void path_to_string(struct b_object *obj, struct b_stream *out);
|
static void path_to_string(const struct b_object *obj, struct b_stream *out);
|
||||||
|
|
||||||
static struct b_object_type path_type = {
|
static struct b_object_type path_type = {
|
||||||
.t_name = "corelib::path",
|
.t_name = "corelib::path",
|
||||||
@@ -58,7 +58,7 @@ struct b_path *b_path_create_root()
|
|||||||
|
|
||||||
b_string_append_cstr(path->pathstr, system_drive);
|
b_string_append_cstr(path->pathstr, system_drive);
|
||||||
if (system_drive[system_drive_len - 1] != '\\') {
|
if (system_drive[system_drive_len - 1] != '\\') {
|
||||||
b_string_append_cstr(path->pathstr, "\\");
|
b_string_append_c(path->pathstr, '\\');
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
@@ -108,8 +108,7 @@ struct b_path *b_path_create_from_cstr(const char *cstr)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char s[] = {c, 0};
|
b_string_append_c(path->pathstr, c);
|
||||||
b_string_append_cstr(path->pathstr, s);
|
|
||||||
prev = c;
|
prev = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,7 +311,7 @@ void path_release(struct b_object *obj)
|
|||||||
b_string_release(path->pathstr);
|
b_string_release(path->pathstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void path_to_string(struct b_object *obj, struct b_stream *out)
|
void path_to_string(const struct b_object *obj, struct b_stream *out)
|
||||||
{
|
{
|
||||||
struct b_path *path = (struct b_path *)obj;
|
struct b_path *path = (struct b_path *)obj;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user