shithub: orca

Download patch

ref: 912f25aa49cc82f9c0d8b8bf1b7b927ff070b6b8
parent: c74a338d5bb9c2b4ee26c9b2751d0892c532c7ae
author: cancel <cancel@cancel.fm>
date: Tue Feb 4 19:54:01 EST 2020

Fix naming mixup in oso.c for osocatprintf/osoputprintf

Oops. Noticed once we actually needed to use it for its intended
purpose.

--- a/thirdparty/oso.c
+++ b/thirdparty/oso.c
@@ -123,12 +123,22 @@
   osoputlen(p, (char const *)other, OSO_HDR(other)->len);
 }
 void osoputvprintf(oso **p, char const *fmt, va_list ap) {
-  *p = oso_impl_catvprintf(*p, fmt, ap);
+  oso *s = *p;
+  if (s) {
+    OSO_HDR(s)->len = 0;
+    ((char *)s)[0] = '\0';
+  }
+  *p = oso_impl_catvprintf(s, fmt, ap);
 }
 void osoputprintf(oso **p, char const *fmt, ...) {
+  oso *s = *p;
+  if (s) {
+    OSO_HDR(s)->len = 0;
+    ((char *)s)[0] = '\0';
+  }
   va_list ap;
   va_start(ap, fmt);
-  *p = oso_impl_catvprintf(*p, fmt, ap);
+  *p = oso_impl_catvprintf(s, fmt, ap);
   va_end(ap);
 }
 void osocat(oso **p, char const *cstr) { osocatlen(p, cstr, strlen(cstr)); }
@@ -151,22 +161,12 @@
   osocatlen(p, (char const *)other, OSO_HDR(other)->len);
 }
 void osocatvprintf(oso **p, char const *fmt, va_list ap) {
-  oso *s = *p;
-  if (s) {
-    OSO_HDR(s)->len = 0;
-    ((char *)s)[0] = '\0';
-  }
-  *p = oso_impl_catvprintf(s, fmt, ap);
+  *p = oso_impl_catvprintf(*p, fmt, ap);
 }
 void osocatprintf(oso **p, char const *fmt, ...) {
-  oso *s = *p;
-  if (s) {
-    OSO_HDR(s)->len = 0;
-    ((char *)s)[0] = '\0';
-  }
   va_list ap;
   va_start(ap, fmt);
-  *p = oso_impl_catvprintf(s, fmt, ap);
+  *p = oso_impl_catvprintf(*p, fmt, ap);
   va_end(ap);
 }
 void osoclear(oso **p) {