aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2006-11-12 17:06:16 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2006-11-12 17:06:16 +0000
commit20485b49854e932244a8602422c14ea3839e6a9c (patch)
tree64855a54b2b7ec283869d9c6989d4e253099178b
parentd98f52530e66c3c2db4f6a69e5d36b647bf452e8 (diff)
downloadpaludis-20485b49854e932244a8602422c14ea3839e6a9c.tar.gz
paludis-20485b49854e932244a8602422c14ea3839e6a9c.tar.xz
Change STR2CSTR to StringValuePtr in ruby bindings.
-rw-r--r--ruby/dep_atom.cc6
-rw-r--r--ruby/environment.cc17
-rw-r--r--ruby/log.cc4
-rw-r--r--ruby/package_database.cc8
-rw-r--r--ruby/package_database_entry.cc6
-rw-r--r--ruby/portage_dep_parser.cc10
-rw-r--r--ruby/qualified_package_name.cc8
-rw-r--r--ruby/repository.cc4
-rw-r--r--ruby/version_spec.cc4
9 files changed, 35 insertions, 32 deletions
diff --git a/ruby/dep_atom.cc b/ruby/dep_atom.cc
index d74dda1..71e1626 100644
--- a/ruby/dep_atom.cc
+++ b/ruby/dep_atom.cc
@@ -63,7 +63,7 @@ namespace
try
{
ptr = new UseDepAtom::ConstPointer(new UseDepAtom(
- UseFlagName(STR2CSTR(pkg)), Qfalse != inverse && Qnil != inverse));
+ UseFlagName(StringValuePtr(pkg)), Qfalse != inverse && Qnil != inverse));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<UseDepAtom::ConstPointer>::free, ptr));
rb_obj_call_init(tdata, 2, &pkg);
return tdata;
@@ -111,7 +111,7 @@ namespace
typename A_::ConstPointer * ptr(0);
try
{
- ptr = new typename A_::ConstPointer(new A_(STR2CSTR(s)));
+ ptr = new typename A_::ConstPointer(new A_(StringValuePtr(s)));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<typename A_::ConstPointer>::free, ptr));
rb_obj_call_init(tdata, 1, &s);
return tdata;
@@ -195,7 +195,7 @@ PackageDepAtom::ConstPointer
paludis::ruby::value_to_package_dep_atom(VALUE v)
{
if (T_STRING == TYPE(v))
- return PackageDepAtom::ConstPointer(new PackageDepAtom(STR2CSTR(v)));
+ return PackageDepAtom::ConstPointer(new PackageDepAtom(StringValuePtr(v)));
else
{
PackageDepAtom::ConstPointer * v_ptr;
diff --git a/ruby/environment.cc b/ruby/environment.cc
index b10d2a2..e0ced2d 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -69,7 +69,7 @@ namespace
if (2 == argc)
Data_Get_Struct(argv[1], PackageDatabaseEntry, pde_ptr);
- return env_data->env_ptr->query_use(UseFlagName(STR2CSTR(argv[0])), pde_ptr) ? Qtrue : Qfalse;
+ return env_data->env_ptr->query_use(UseFlagName(StringValuePtr(argv[0])), pde_ptr) ? Qtrue : Qfalse;
}
else
rb_raise(rb_eArgError, "Environment.query_use expects one or two arguments, but got %d", argc);
@@ -95,7 +95,7 @@ namespace
Data_Get_Struct(argv[1], PackageDatabaseEntry, pde_ptr);
return env_data->env_ptr->accept_keyword(KeywordName(
- STR2CSTR(argv[0])), pde_ptr) ? Qtrue : Qfalse;
+ StringValuePtr(argv[0])), pde_ptr) ? Qtrue : Qfalse;
}
else
rb_raise(rb_eArgError, "Environment.accept_keyword expects one or two arguments, but got %d", argc);
@@ -121,7 +121,7 @@ namespace
Data_Get_Struct(argv[1], PackageDatabaseEntry, pde_ptr);
return env_data->env_ptr->accept_license(
- std::string(STR2CSTR(argv[0])), pde_ptr) ? Qtrue : Qfalse;
+ std::string(StringValuePtr(argv[0])), pde_ptr) ? Qtrue : Qfalse;
}
else
rb_raise(rb_eArgError, "Environment.accept_license expects one or two arguments, but got %d", argc);
@@ -175,7 +175,7 @@ namespace
try
{
- return dep_atom_to_value(env_data->env_ptr->package_set(SetName(STR2CSTR(set_name))));
+ return dep_atom_to_value(env_data->env_ptr->package_set(SetName(StringValuePtr(set_name))));
}
catch (const std::exception & e)
{
@@ -201,7 +201,7 @@ namespace
{
try
{
- DefaultConfig::set_config_suffix(stringify(STR2CSTR(str)));
+ DefaultConfig::set_config_suffix(stringify(StringValuePtr(str)));
return klass;
}
catch (const std::exception & e)
@@ -223,9 +223,12 @@ namespace
try
{
if (T_STRING == TYPE(s))
- path = STR2CSTR(s);
+ path = StringValuePtr(s);
else if (rb_obj_is_kind_of(s, rb_cDir))
- path = STR2CSTR(rb_funcall(s, rb_intern("path"), 0));
+ {
+ VALUE v = rb_funcall(s, rb_intern("path"), 0);
+ path = StringValuePtr(v);
+ }
else
rb_raise(rb_eTypeError, "NoConfigEnvironment.new expects a string or Dir");
diff --git a/ruby/log.cc b/ruby/log.cc
index 4461678..b270f22 100644
--- a/ruby/log.cc
+++ b/ruby/log.cc
@@ -47,7 +47,7 @@ namespace
VALUE
log_set_program_name(VALUE self, VALUE name)
{
- Log::get_instance()->set_program_name(stringify(STR2CSTR(name)));
+ Log::get_instance()->set_program_name(stringify(StringValuePtr(name)));
return self;
}
@@ -55,7 +55,7 @@ namespace
log_message(VALUE self, VALUE log_level, VALUE message)
{
Log::get_instance()->message(static_cast<LogLevel>(NUM2INT(log_level)), lc_no_context,
- stringify(STR2CSTR(message)));
+ stringify(StringValuePtr(message)));
return self;
}
diff --git a/ruby/package_database.cc b/ruby/package_database.cc
index 4918a9d..beb0b17 100644
--- a/ruby/package_database.cc
+++ b/ruby/package_database.cc
@@ -55,7 +55,7 @@ namespace
PackageDatabase::Pointer * self_ptr;
Data_Get_Struct(self, PackageDatabase::Pointer, self_ptr);
return rb_str_new2(stringify((*self_ptr)->fetch_unique_qualified_package_name(
- PackageNamePart(STR2CSTR(pkg)))).c_str());
+ PackageNamePart(StringValuePtr(pkg)))).c_str());
}
catch (const std::exception & e)
{
@@ -116,7 +116,7 @@ namespace
PackageDatabase::Pointer * self_ptr;
Data_Get_Struct(self, PackageDatabase::Pointer, self_ptr);
- return repository_to_value((*self_ptr)->fetch_repository(RepositoryName(STR2CSTR(name))));
+ return repository_to_value((*self_ptr)->fetch_repository(RepositoryName(StringValuePtr(name))));
}
catch (const std::exception & e)
{
@@ -133,8 +133,8 @@ namespace
Data_Get_Struct(self, PackageDatabase::Pointer, self_ptr);
return rb_str_new2(stringify((*self_ptr)->better_repository(
- RepositoryName(STR2CSTR(name1)),
- RepositoryName(STR2CSTR(name2))
+ RepositoryName(StringValuePtr(name1)),
+ RepositoryName(StringValuePtr(name2))
)).c_str());
}
catch (const std::exception & e)
diff --git a/ruby/package_database_entry.cc b/ruby/package_database_entry.cc
index ebab07c..8f0e805 100644
--- a/ruby/package_database_entry.cc
+++ b/ruby/package_database_entry.cc
@@ -46,8 +46,8 @@ namespace
{
VersionSpec vv(value_to_version_spec(v));
- ptr = new PackageDatabaseEntry(QualifiedPackageName(STR2CSTR(q)), vv,
- RepositoryName(STR2CSTR(n)));
+ ptr = new PackageDatabaseEntry(QualifiedPackageName(StringValuePtr(q)), vv,
+ RepositoryName(StringValuePtr(n)));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<PackageDatabaseEntry>::free, ptr));
rb_obj_call_init(tdata, 3, argv);
return tdata;
@@ -139,7 +139,7 @@ namespace
{
PackageDatabaseEntry * p;
Data_Get_Struct(self, PackageDatabaseEntry, p);
- p->*m_ = T_ ((STR2CSTR(str)));
+ p->*m_ = T_ ((StringValuePtr(str)));
return self;
}
catch (const std::exception & e)
diff --git a/ruby/portage_dep_parser.cc b/ruby/portage_dep_parser.cc
index 9b99781..725d8d7e 100644
--- a/ruby/portage_dep_parser.cc
+++ b/ruby/portage_dep_parser.cc
@@ -36,7 +36,7 @@ namespace
try
{
if (1 == argc)
- return dep_atom_to_value(PortageDepParser::parse(STR2CSTR(args[0])));
+ return dep_atom_to_value(PortageDepParser::parse(StringValuePtr(args[0])));
else if (3 == argc)
{
bool b(! (args[2] == Qnil || args[2] == Qfalse));
@@ -45,17 +45,17 @@ namespace
{
case 17:
if (b)
- return dep_atom_to_value(PortageDepParser::parse(STR2CSTR(args[0]),
+ return dep_atom_to_value(PortageDepParser::parse(StringValuePtr(args[0]),
PortageDepParserPolicy<PackageDepAtom, true>::get_instance()));
else
- return dep_atom_to_value(PortageDepParser::parse(STR2CSTR(args[0]),
+ return dep_atom_to_value(PortageDepParser::parse(StringValuePtr(args[0]),
PortageDepParserPolicy<PackageDepAtom, false>::get_instance()));
case 23:
if (b)
- return dep_atom_to_value(PortageDepParser::parse(STR2CSTR(args[0]),
+ return dep_atom_to_value(PortageDepParser::parse(StringValuePtr(args[0]),
PortageDepParserPolicy<PlainTextDepAtom, true>::get_instance()));
else
- return dep_atom_to_value(PortageDepParser::parse(STR2CSTR(args[0]),
+ return dep_atom_to_value(PortageDepParser::parse(StringValuePtr(args[0]),
PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance()));
}
diff --git a/ruby/qualified_package_name.cc b/ruby/qualified_package_name.cc
index 1079134..29a642e 100644
--- a/ruby/qualified_package_name.cc
+++ b/ruby/qualified_package_name.cc
@@ -44,11 +44,11 @@ namespace
{
if (1 == argc)
{
- ptr = new QualifiedPackageName(STR2CSTR(argv[0]));
+ ptr = new QualifiedPackageName(StringValuePtr(argv[0]));
}
else if (2 == argc)
{
- ptr = new QualifiedPackageName(CategoryNamePart(STR2CSTR(argv[0])), PackageNamePart(STR2CSTR(argv[1])));
+ ptr = new QualifiedPackageName(CategoryNamePart(StringValuePtr(argv[0])), PackageNamePart(StringValuePtr(argv[1])));
}
else
{
@@ -83,7 +83,7 @@ namespace
{
QualifiedPackageName * p;
Data_Get_Struct(self, QualifiedPackageName, p);
- p->*m_ = T_ ((STR2CSTR(str)));
+ p->*m_ = T_ ((StringValuePtr(str)));
return self;
}
catch (const std::exception & e)
@@ -128,7 +128,7 @@ QualifiedPackageName
paludis::ruby::value_to_qualified_package_name(VALUE v)
{
if (T_STRING == TYPE(v))
- return QualifiedPackageName(STR2CSTR(v));
+ return QualifiedPackageName(StringValuePtr(v));
else
{
QualifiedPackageName * v_ptr;
diff --git a/ruby/repository.cc b/ruby/repository.cc
index c4bed13..103832e 100644
--- a/ruby/repository.cc
+++ b/ruby/repository.cc
@@ -55,7 +55,7 @@ namespace
{
Repository::ConstPointer * self_ptr;
Data_Get_Struct(self, Repository::ConstPointer, self_ptr);
- return (*self_ptr)->has_category_named(CategoryNamePart(STR2CSTR(cat))) ? Qtrue : Qfalse;
+ return (*self_ptr)->has_category_named(CategoryNamePart(StringValuePtr(cat))) ? Qtrue : Qfalse;
}
catch (const std::exception & e)
{
@@ -120,7 +120,7 @@ namespace
{
Repository::ConstPointer * self_ptr;
Data_Get_Struct(self, Repository::ConstPointer, self_ptr);
- CategoryNamePart category(STR2CSTR(cat));
+ CategoryNamePart category(StringValuePtr(cat));
VALUE result(rb_ary_new());
QualifiedPackageNameCollection::ConstPointer c((*self_ptr)->package_names(category));
diff --git a/ruby/version_spec.cc b/ruby/version_spec.cc
index 725e873..6eb66c3 100644
--- a/ruby/version_spec.cc
+++ b/ruby/version_spec.cc
@@ -42,7 +42,7 @@ namespace
VersionSpec * ptr(0);
try
{
- ptr = new VersionSpec(std::string(STR2CSTR(s)));
+ ptr = new VersionSpec(std::string(StringValuePtr(s)));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<VersionSpec>::free, ptr));
rb_obj_call_init(tdata, 1, &s);
return tdata;
@@ -97,7 +97,7 @@ VersionSpec
paludis::ruby::value_to_version_spec(VALUE v)
{
if (T_STRING == TYPE(v))
- return VersionSpec(STR2CSTR(v));
+ return VersionSpec(StringValuePtr(v));
else
{
VersionSpec * v_ptr;