We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd158a3 commit b873969Copy full SHA for b873969
1 file changed
src/dmd/backend/outbuf.d
@@ -261,6 +261,40 @@ struct Outbuffer
261
writeString(cast(const(char)[])(s));
262
}
263
264
+ /**
265
+ * Inserts string at beginning of buffer.
266
+ */
267
+ @trusted
268
+ void prependBytes(const(char)* s)
269
+ {
270
+ prepend(s, strlen(s));
271
+ }
272
+
273
274
+ * Inserts bytes at beginning of buffer.
275
276
277
+ void prepend(const(void)* b, size_t len)
278
279
+ reserve(len);
280
+ memmove(buf + len,buf,p - buf);
281
+ memcpy(buf,b,len);
282
+ p += len;
283
284
285
286
+ * Bracket buffer contents with c1 and c2.
287
288
289
+ void bracket(char c1,char c2)
290
291
+ reserve(2);
292
+ memmove(buf + 1,buf,p - buf);
293
+ buf[0] = c1;
294
+ p[1] = c2;
295
+ p += 2;
296
297
298
/**
299
* Returns the number of bytes written.
300
*/
0 commit comments