Loading...
mach_o/Error.cpp dyld-1122.1 dyld-1335
--- dyld/dyld-1122.1/mach_o/Error.cpp
+++ dyld/dyld-1335/mach_o/Error.cpp
@@ -53,6 +53,14 @@
     return *this;
 }
 
+
+Error Error::copy(const Error& other)
+{
+    if ( other.noError() )
+        return Error::none();
+    return Error("%s", other.message());
+}
+
 Error::~Error()
 {
 #if TARGET_OS_EXCLAVEKIT
@@ -78,14 +86,14 @@
     va_end(list);
 }
 
-Error::Error(const char* format, va_list list)
+Error::Error(const char* format, va_list_wrap vaWrap)
 {
 #if TARGET_OS_EXCLAVEKIT
-    vsnprintf(_strBuf, sizeof(_strBuf), format, list);
+    vsnprintf(_strBuf, sizeof(_strBuf), format, vaWrap.list);
 #else
     if ( _buffer == nullptr )
         _buffer = _simple_salloc();
-    _simple_vsprintf(_buffer, format, list);
+    _simple_vsprintf(_buffer, format, vaWrap.list);
 #endif
 }
 
@@ -109,4 +117,23 @@
 #endif
 }
 
+void Error::append(const char* format, ...)
+{
+#if TARGET_OS_EXCLAVEKIT
+   size_t len = strlen(_strBuf);
+   va_list list;
+   va_start(list, format);
+   vsnprintf(&_strBuf[len], sizeof(_strBuf)-len, format, list);
+   va_end(list);
+#else
+    assert(_buffer != nullptr);
+    _simple_sresize(_buffer);   // move insertion point to end of existing string in buffer
+    va_list list;
+    va_start(list, format);
+    _simple_vsprintf(_buffer, format, list);
+    va_end(list);
+#endif
+}
+
+
 } // namespace mach_o