Sha256: f216d4d482da3e3a3888cc907cb1db8f3fd703e96a1147980d30328611f41253

Contents?: true

Size: 514 Bytes

Versions: 3

Compression:

Stored size: 514 Bytes

Contents

#include "nameparse.h"

int nameparse(unsigned char *s,const char *x)
{
  long long pos;
  long long j;
  if (!x) return 0;
  for (pos = 0;pos < 256;++pos) s[pos] = 0;
  pos = 0;
  while (*x) {
    if (*x == '.') { ++x; continue; }
    for (j = 0;x[j];++j) if (x[j] == '.') break;
    if (j > 63) return 0;
    if (pos < 0 || pos >= 256) return 0; s[pos++] = j;
    while (j > 0) { if (pos < 0 || pos >= 256) return 0; s[pos++] = *x++; --j; }
  }
  if (pos < 0 || pos >= 256) return 0; s[pos++] = 0;
  return 1;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_nacl-0.1.2 ext/ruby_nacl/NaCl/curvecp/nameparse.c
ruby_nacl-0.1.1 ext/ruby_nacl/NaCl/curvecp/nameparse.c
ruby_nacl-0.1.0 ext/ruby_nacl/NaCl/curvecp/nameparse.c