[beast: 18/24] TOOLS: use Rapicorn's string_format()
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 18/24] TOOLS: use Rapicorn's string_format()
- Date: Thu, 24 Sep 2015 20:11:07 +0000 (UTC)
commit 82b3980460a4eb06ad068603fa958209f03831b7
Author: Tim Janik <timj gnu org>
Date: Wed Sep 23 11:02:39 2015 +0200
TOOLS: use Rapicorn's string_format()
shell/bsescminterp.cc | 10 ++++------
tools/bsefcompare.cc | 19 ++-----------------
2 files changed, 6 insertions(+), 23 deletions(-)
---
diff --git a/shell/bsescminterp.cc b/shell/bsescminterp.cc
index e2271df..7adf19c 100644
--- a/shell/bsescminterp.cc
+++ b/shell/bsescminterp.cc
@@ -371,10 +371,9 @@ bse_scm_proxy_print (SCM scm_p1,
scm_print_state *pstate)
{
SfiProxy p1 = SCM_GET_GLUE_PROXY (scm_p1);
- char buffer[128];
- g_snprintf (buffer, sizeof (buffer), "%08lx (ID:%04lx)", (unsigned long) SCM_SMOB_DATA (scm_p1), (unsigned
long) p1);
+ String str = string_format ("%08lx (ID:%04lx)", (unsigned long) SCM_SMOB_DATA (scm_p1), (unsigned long)
p1);
scm_puts ("#<SfiProxy ", port);
- scm_puts (buffer, port);
+ scm_puts (str.c_str(), port);
scm_puts (">", port);
return 1;
}
@@ -973,9 +972,8 @@ bse_scm_script_register (SCM s_name,
else
sfi_seq_append (seq, val = sfi_value_string ("Scheme"));
sfi_value_free (val);
- char buffer[64] = "";
- g_snprintf (buffer, 64, "%u", (int) (IS_SCM_SFI_NUM (s_line) ? num_from_scm (s_line) + 1 : 0));
- sfi_seq_append (seq, val = sfi_value_string (buffer));
+ String str = string_format ("%u", (int) (IS_SCM_SFI_NUM (s_line) ? num_from_scm (s_line) + 1 : 0));
+ sfi_seq_append (seq, val = sfi_value_string (str.c_str()));
sfi_value_free (val);
sfi_seq_append (seq, val = string_value_from_scm (s_author));
sfi_value_free (val);
diff --git a/tools/bsefcompare.cc b/tools/bsefcompare.cc
index c1ad26e..aabbb90 100644
--- a/tools/bsefcompare.cc
+++ b/tools/bsefcompare.cc
@@ -220,21 +220,6 @@ vector_similarity (const vector<double>& f1, const vector<double>& f2)
return diff / f1len / f2len;
}
-static string string_printf (const char *format, ...) G_GNUC_PRINTF (1, 2);
-
-static string
-string_printf (const char *format, ...)
-{
- va_list ap;
- va_start(ap, format);
- char *c_str = g_strdup_vprintf (format, ap);
- va_end(ap);
- string str = c_str;
- g_free (c_str);
- return str;
-}
-
-
static GScannerConfig scanner_config_template = {
const_cast<gchar *> /* FIXME: glib should use const gchar* here */
(
@@ -487,7 +472,7 @@ FeatureValueVector::parse (GScanner *scanner)
string
FeatureValueVector::printable_type() const
{
- return string_printf ("%d element vector", n);
+ return string_format ("%d element vector", n);
}
double
@@ -544,7 +529,7 @@ FeatureValueMatrix::parse (GScanner *scanner)
string
FeatureValueMatrix::printable_type() const
{
- return string_printf ("%d x %d matrix", m, n);
+ return string_format ("%d x %d matrix", m, n);
}
double
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]