mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-23 09:43:06 +00:00
libdrgn: move string_builder_line_break() to string_builder.c
This commit is contained in:
parent
0ebcfc8178
commit
ce808440f7
@ -1040,17 +1040,6 @@ open_kernel_module_debug_info(struct drgn_program *prog,
|
|||||||
return &drgn_stop;
|
return &drgn_stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Append a newline character if the string isn't empty and doesn't already end
|
|
||||||
* in a newline.
|
|
||||||
*/
|
|
||||||
static bool string_builder_line_break(struct string_builder *sb)
|
|
||||||
{
|
|
||||||
if (!sb->len || sb->str[sb->len - 1] == '\n')
|
|
||||||
return true;
|
|
||||||
return string_builder_appendc(sb, '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct drgn_error *
|
static struct drgn_error *
|
||||||
open_loaded_kernel_modules(struct drgn_program *prog,
|
open_loaded_kernel_modules(struct drgn_program *prog,
|
||||||
struct string_builder *missing_debug_info)
|
struct string_builder *missing_debug_info)
|
||||||
|
@ -86,3 +86,10 @@ bool string_builder_appendf(struct string_builder *sb, const char *format, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool string_builder_line_break(struct string_builder *sb)
|
||||||
|
{
|
||||||
|
if (!sb->len || sb->str[sb->len - 1] == '\n')
|
||||||
|
return true;
|
||||||
|
return string_builder_appendc(sb, '\n');
|
||||||
|
}
|
||||||
|
@ -144,6 +144,16 @@ bool string_builder_appendf(struct string_builder *sb, const char *format, ...)
|
|||||||
bool string_builder_vappendf(struct string_builder *sb, const char *format,
|
bool string_builder_vappendf(struct string_builder *sb, const char *format,
|
||||||
va_list ap);
|
va_list ap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append a newline character to a @ref string_builder if the string isn't empty
|
||||||
|
* and doesn't already end in a newline.
|
||||||
|
*
|
||||||
|
* @param[in] sb String builder.
|
||||||
|
* @return @c true on success, @c false on error (if we couldn't allocate
|
||||||
|
* memory).
|
||||||
|
*/
|
||||||
|
bool string_builder_line_break(struct string_builder *sb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback to append to a string later.
|
* Callback to append to a string later.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user