Skip to content

Commit 42656af

Browse files
grendellojonpryor
authored andcommitted
[monodroid] Glue and utilities code changes for C++-ification (#2611)
As part of our continued "C++ification" effort (434d2d8, etc.), additional cleanups for `src/monodroid`: * Use `new/new[]/delete/delete[]` more * Avoid calling the `printf()` family of functions in favor of new, template `Utils.string_concat()` member function. When `sprintf()` is used to concatenate just strings we can do better by not calling the C varargs functions and generate very efficient code. * Replace C `strdup()` calls with `Utils.strdup_new()`, which uses `new char[]` to allocate memory.
1 parent efbec22 commit 42656af

File tree

5 files changed

+166
-67
lines changed

5 files changed

+166
-67
lines changed

src/monodroid/jni/embedded-assemblies.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void EmbeddedAssemblies::set_assemblies_prefix (const char *prefix)
5353
{
5454
if (assemblies_prefix_override != nullptr)
5555
delete[] assemblies_prefix_override;
56-
assemblies_prefix_override = prefix != nullptr ? strdup (prefix) : nullptr;
56+
assemblies_prefix_override = prefix != nullptr ? utils.strdup_new (prefix) : nullptr;
5757
}
5858

5959
MonoAssembly*

src/monodroid/jni/embedded-assemblies.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,4 @@ namespace xamarin { namespace android { namespace internal {
8383
}}}
8484

8585
MONO_API int monodroid_embedded_assemblies_set_assemblies_prefix (const char *prefix);
86-
8786
#endif /* INC_MONODROID_EMBEDDED_ASSEMBLIES_H */

0 commit comments

Comments
 (0)