Recast more internal string routines to use growable-strings
[exim.git] / src / src / transport.c
index 5c72e2e2b18431a220c1baaba26aa705d5f31b8b..8ccdd03890121acf320f48f780e74e782254f2f2 100644 (file)
@@ -256,7 +256,7 @@ for (i = 0; i < 100; i++)
 
   else
     {
-    alarm(local_timeout);
+    ALARM(local_timeout);
 
     rc =
 #ifdef SUPPORT_TLS
@@ -269,7 +269,7 @@ for (i = 0; i < 100; i++)
        write(fd, block, len);
 
     save_errno = errno;
-    local_timeout = alarm(0);
+    local_timeout = ALARM_CLR(0);
     if (sigalrm_seen)
       {
       errno = ETIMEDOUT;
@@ -375,13 +375,15 @@ BOOL
 transport_write_string(int fd, const char *format, ...)
 {
 transport_ctx tctx = {{0}};
+gstring gs = { .size = big_buffer_size, .ptr = 0, .s = big_buffer };
 va_list ap;
+
 va_start(ap, format);
-if (!string_vformat(big_buffer, big_buffer_size, format, ap))
+if (!string_vformat(&gs, FALSE, format, ap))
   log_write(0, LOG_MAIN|LOG_PANIC_DIE, "overlong formatted string in transport");
 va_end(ap);
 tctx.u.fd = fd;
-return transport_write_block(&tctx, big_buffer, Ustrlen(big_buffer), FALSE);
+return transport_write_block(&tctx, gs.s, gs.ptr, FALSE);
 }
 
 
@@ -1300,9 +1302,9 @@ chunk_ptr = deliver_out_buffer;
 for (;;)
   {
   sigalrm_seen = FALSE;
-  alarm(transport_filter_timeout);
+  ALARM(transport_filter_timeout);
   len = read(fd_read, deliver_in_buffer, DELIVER_IN_BUFFER_SIZE);
-  alarm(0);
+  ALARM_CLR(0);
   if (sigalrm_seen)
     {
     errno = ETIMEDOUT;