text / benchmarks / cbits / time_iconv.c

The default branch has multiple heads

#include <iconv.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>

int time_iconv(char *srcbuf, size_t srcbufsize)
  uint16_t *destbuf = NULL;
  size_t destbufsize;
  static uint16_t *origdestbuf;
  static size_t origdestbufsize;
  iconv_t ic = (iconv_t) -1;
  int ret = 0;

  if (ic == (iconv_t) -1) {
    ic = iconv_open("UTF-16LE", "UTF-8");
    if (ic == (iconv_t) -1) {
      ret = -1;
      goto done;
  destbufsize = srcbufsize * sizeof(uint16_t);
  if (destbufsize > origdestbufsize) {
    origdestbuf = destbuf = malloc(origdestbufsize = destbufsize);
  } else {
    destbuf = origdestbuf;

  iconv(ic, &srcbuf, &srcbufsize, (char**) &destbuf, &destbufsize);

  return ret;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.