Skip to content
Snippets Groups Projects
Select Git revision
  • cfa248269b2c3ecd9281e36dd68ff38ca3bf6d1b
  • master default protected
  • 9.0
  • marcus/wix3
  • 8.0
  • nt-tools
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • v8.0.2020
  • v8.0.2018
  • v8.0.2016
  • v8.0.2014
  • v8.0.2012
  • v8.0.2008
  • v8.0.2006
  • v8.0.2004
  • v8.0.2002
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
41 results

postgres_result.pike

Blame
  • testutils.c 36.34 KiB
    /* testutils.c */
    
    #include "testutils.h"
    
    #include "base16.h"
    #include "cbc.h"
    #include "ctr.h"
    #include "knuth-lfib.h"
    #include "macros.h"
    #include "nettle-internal.h"
    
    #include <assert.h>
    #include <ctype.h>
    
    void
    die(const char *format, ...)
    {
      va_list args;
      va_start(args, format);
      vfprintf(stderr, format, args);
      va_end(args);
    
      abort ();
    }
    
    void *
    xalloc(size_t size)
    {
      void *p = malloc(size);
      if (size && !p)
        {
          fprintf(stderr, "Virtual memory exhausted.\n");
          abort();
        }
    
      return p;
    }
    
    static struct tstring *tstring_first = NULL;
    
    struct tstring *
    tstring_alloc (size_t length)
    {
      struct tstring *s = xalloc(sizeof(struct tstring) + length);
      s->length = length;
      s->next = tstring_first;
      /* NUL-terminate, for convenience. */
      s->data[length] = '\0';
      tstring_first = s;
      return s;
    }
    
    void
    tstring_clear(void)
    {
      while (tstring_first)
        {
          struct tstring *s = tstring_first;
          tstring_first = s->next;
          free(s);
        }
    }
    
    struct tstring *
    tstring_data(size_t length, const char *data)
    {
      struct tstring *s = tstring_alloc (length);
      memcpy (s->data, data, length);
      return s;
    }