@@ -195,7 +195,7 @@ namespace questdb::ilp
195195 * auto validated = "A UTF-8 encoded string"_utf8;
196196 * @endcode
197197 */
198- utf8_view operator " " _utf8(const char * buf, size_t len)
198+ inline utf8_view operator " " _utf8(const char * buf, size_t len)
199199 {
200200 return utf8_view{buf, len};
201201 }
@@ -206,7 +206,7 @@ namespace questdb::ilp
206206 * auto table_name = "events"_tn;
207207 * @endcode
208208 */
209- table_name_view operator " " _tn(const char * buf, size_t len)
209+ inline table_name_view operator " " _tn(const char * buf, size_t len)
210210 {
211211 return table_name_view{buf, len};
212212 }
@@ -217,7 +217,7 @@ namespace questdb::ilp
217217 * auto column_name = "events"_cn;
218218 * @endcode
219219 */
220- column_name_view operator " " _cn(const char * buf, size_t len)
220+ inline column_name_view operator " " _cn(const char * buf, size_t len)
221221 {
222222 return column_name_view{buf, len};
223223 }
@@ -271,11 +271,10 @@ namespace questdb::ilp
271271 line_sender_buffer (
272272 size_t init_capacity,
273273 size_t max_name_len) noexcept
274- : _impl{:: line_sender_buffer_with_max_name_len (max_name_len) }
274+ : _impl{nullptr }
275275 , _init_capacity{init_capacity}
276276 , _max_name_len{max_name_len}
277277 {
278- ::line_sender_buffer_reserve (_impl, init_capacity);
279278 }
280279
281280 line_sender_buffer (const line_sender_buffer& other) noexcept
@@ -297,7 +296,10 @@ namespace questdb::ilp
297296 if (this != &other)
298297 {
299298 ::line_sender_buffer_free (_impl);
300- _impl = ::line_sender_buffer_clone (other._impl );
299+ if (other._impl )
300+ _impl = ::line_sender_buffer_clone (other._impl );
301+ else
302+ _impl = nullptr ;
301303 _init_capacity = other._init_capacity ;
302304 _max_name_len = other._max_name_len ;
303305 }
@@ -333,13 +335,9 @@ namespace questdb::ilp
333335 size_t capacity () const noexcept
334336 {
335337 if (_impl)
336- {
337338 return ::line_sender_buffer_capacity (_impl);
338- }
339339 else
340- {
341- return _init_capacity;
342- }
340+ return 0 ;
343341 }
344342
345343 size_t size () const noexcept
@@ -381,17 +379,13 @@ namespace questdb::ilp
381379 void clear_marker () noexcept
382380 {
383381 if (_impl)
384- {
385382 ::line_sender_buffer_clear_marker (_impl);
386- }
387383 }
388384
389385 void clear () noexcept
390386 {
391387 if (_impl)
392- {
393388 ::line_sender_buffer_clear (_impl);
394- }
395389 }
396390
397391 /* *
@@ -566,7 +560,7 @@ namespace questdb::ilp
566560 ::line_sender_buffer_free (_impl);
567561 }
568562 private:
569- void may_init ()
563+ inline void may_init ()
570564 {
571565 if (!_impl)
572566 {
@@ -788,6 +782,7 @@ namespace questdb::ilp
788782 */
789783 void flush (line_sender_buffer& buffer)
790784 {
785+ buffer.may_init ();
791786 ensure_impl ();
792787 line_sender_error::wrapped_call (
793788 ::line_sender_flush,
@@ -803,11 +798,23 @@ namespace questdb::ilp
803798 */
804799 void flush_and_keep (const line_sender_buffer& buffer)
805800 {
806- ensure_impl ();
807- line_sender_error::wrapped_call (
808- ::line_sender_flush_and_keep,
809- _impl,
810- buffer._impl );
801+ if (buffer._impl )
802+ {
803+ ensure_impl ();
804+ line_sender_error::wrapped_call (
805+ ::line_sender_flush_and_keep,
806+ _impl,
807+ buffer._impl );
808+ }
809+ else
810+ {
811+ line_sender_buffer buffer2{0 };
812+ buffer2.may_init ();
813+ line_sender_error::wrapped_call (
814+ ::line_sender_flush_and_keep,
815+ _impl,
816+ buffer2._impl );
817+ }
811818 }
812819
813820 /* *
0 commit comments