Exemple #1
0
const char *
fnnalloc(const char *s, size_t len)
{
	fn_t	*fn;

	static	int	nxt_id = 0;

	if (s == NULL)
		return (NULL);

	if ((fn = srchfn(s, len)) == NULL) {
		if ((fn = malloc(sizeof (fn_t))) == NULL)
			nomem();
		/* Do not used strdup() because string is not NUL-terminated.*/
		if ((fn->fn_name = malloc(len + 1)) == NULL)
			nomem();
		(void)memcpy(fn->fn_name, s, len);
		fn->fn_name[len] = '\0';
		fn->fn_len = len;
		fn->fn_id = nxt_id++;
		fn->fn_nxt = fnames;
		fnames = fn;
		/* Write id of this filename to the output file. */
		outclr();
		outint(fn->fn_id);
		outchar('s');
		outstrg(fn->fn_name);
	}
	return (fn->fn_name);
}
Exemple #2
0
void copyvalues(struct pars *p1,int ix1,struct pars *p2,int ix2)
{
  int j;

  /* Copy type, value of 'active' and number of values */
  p2->type[ix2]   = p1->type[ix1];
  p2->active[ix2] = p1->active[ix1];
  p2->nvals[ix2]  = p1->nvals[ix1];
  /* Allocate and copy values */
  switch(p2->type[ix2]) {
    case 0:
      if ((p2->i[ix2] = (int *)malloc(p2->nvals[ix2]*sizeof(int *))) == NULL) nomem(__FILE__,__FUNCTION__,__LINE__);
      for (j=0;j<p2->nvals[ix2];j++) p2->i[ix2][j] = p1->i[ix1][j];
      break;
    case 1:
      if ((p2->d[ix2] = (double *)malloc(p2->nvals[ix2]*sizeof(double *))) == NULL) nomem(__FILE__,__FUNCTION__,__LINE__);
      for (j=0;j<p2->nvals[ix2];j++) p2->d[ix2][j] = p1->d[ix1][j];
      break;
    case 2:
      if ((p2->s[ix2] = (char **)malloc(p2->nvals[ix2]*sizeof(char *))) == NULL) nomem(__FILE__,__FUNCTION__,__LINE__);
      for (j=0;j<p2->nvals[ix2];j++) {
        if ((p2->s[ix2][j] = (char *)malloc((strlen(p1->s[ix1][j])+1)*sizeof(char))) == NULL) nomem(__FILE__,__FUNCTION__,__LINE__);
        strcpy(p2->s[ix2][j],p1->s[ix1][j]);
      }
      break;
  } /* end p->type switch */

}
Exemple #3
0
/*
 * Return the index of a file name. If the name cannot be found, create
 * a new entry and return the index of the newly created entry.
 */
static int
getfnidx(const char *fn)
{
	int	i;

	/* 0 ist reserved */
	for (i = 1; fnames[i] != NULL; i++) {
		if (strcmp(fnames[i], fn) == 0)
			break;
	}
	if (fnames[i] != NULL)
		return (i);

	if (i == nfnames - 1) {
		if ((fnames = realloc(fnames, (nfnames * 2) * sizeof (char *)))
		    == NULL)
			nomem();
		(void)memset(fnames + nfnames, 0, nfnames * sizeof (char *));
		nfnames *= 2;
	}

	if ((fnames[i] = strdup(fn)) == NULL)
		nomem();
	return (i);
}
Exemple #4
0
int main(int argc,const char *const *argv,const char *const *envp)
{
  struct passwd *pw;
  const char *account;
  char strnum[FMT_ULONG];

  account = *++argv;
  if (!account || !*++argv)
    usage();

  pw = getpwnam(account);
  if (!pw)
    strerr_die3x(111,FATAL,"unknown account ",account);

  if (!pathexec_env("HOME",pw->pw_dir)) nomem();
  if (!pathexec_env("SHELL",pw->pw_shell)) nomem();
  if (!pathexec_env("USER",pw->pw_name)) nomem();
  strnum[fmt_ulong(strnum,pw->pw_gid)] = 0;
  if (!pathexec_env("GID",strnum)) nomem();
  strnum[fmt_ulong(strnum,pw->pw_uid)] = 0;
  if (!pathexec_env("UID",strnum)) nomem();

  if (chdir(pw->pw_dir) != 0)
    strerr_die3sys(111,FATAL,"unable to chdir to ", pw->pw_dir);
  if (prot_gid(pw->pw_gid) == -1)
    strerr_die2sys(111,FATAL,"unable to setgid");
  if (prot_gids(pw->pw_name, pw->pw_gid) == -1)
    strerr_die2sys(111,FATAL,"unable to initgroups");
  if (prot_uid(pw->pw_uid) == -1)
    strerr_die2sys(111,FATAL,"unable to setuid");

  pathexec_run(*argv,argv,envp);
  strerr_die3sys(111,FATAL,"unable to run ",*argv);
}
Exemple #5
0
void errout(int i)
{
  int j;

  if (!stralloc_copys(&x[i].middle,":")) nomem();
  if (!stralloc_cats(&x[i].middle,error_str(errno))) nomem();
  for (j = 0;j < x[i].middle.len;++j)
    if (x[i].middle.s[j] == ' ')
      x[i].middle.s[j] = '-';
}
Exemple #6
0
int findentries2(void)
{
  switch(findentries2_state) {
    case 0:
      if (!str0_copy(&n,0,&inputfield)) return -1;
      if (!str0_copy(&next,0,&inputfield)) return -1;
      if (!str0_increment(&next,0)) return -1;
      findentries2_state = 1; return 1;
    case 1:
      if (str0_equalc(&inputfield,"leave")) { findentries2_state = 20; return 1; }
      if (str0_equalc(&inputfield,"goto")) { findentries2_state = 30; return 1; }
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&next)) return -1;
      if (!critbit0_insert(&nextinsn,0,&key)) return -1;
      if (str0_equalc(&inputfield,"maybegoto")) { findentries2_state = 30; return 1; }
      if (str0_equalc(&inputfield,"enter")) { findentries2_state = 10; return 1; }
      break;
    case 10:
      if (!critbit0_insert(&blockbegins,0,&n)) return -1;
      if (!critbit0_insert(&entries,0,&n)) return -1;
      if (critbit0_allprefixed(&inputregs,0,&v,&empty,findentries3) < 1) nomem();
      break;
    case 20:
      if (!critbit0_insert(&exits,0,&n)) return -1;
      if (critbit0_allprefixed(&outputregs,0,&v,&empty,findexits3) < 1) nomem();
      break;
    case 30:
      if (!critbit0_insert(&blockbegins,0,&next)) return -1;
      if (!str0_copy(&key,0,&inputfield)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      switch(critbit0_firstprefixed(&labels,0,&next,&key)) {
	case 1:
	  break;
	case 0:
	  if (!str0_copyc(&outputline,0,"error:unknown label ")) return -1;
	  if (!str0_concat(&outputline,0,&key)) return -1;
	  if (!str0_concat(&outputline,0,&inputline)) return -1;
	  str0_putline(&outputline);
	  return 0;
	default: 
	  return -1;
      }
      if (!critbit0_insert(&blockbegins,0,&next)) return -1;
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&next)) return -1;
      if (!critbit0_insert(&nextinsn,0,&key)) return -1;
  }
  return 0;
}
Exemple #7
0
static const where *
get_where( int line, const char *file ) {
  static int init_done = 0;
  static hash *cache = NULL;
  static buffer work;
  where *w;
  int err;
  size_t sz;

  if ( !file ) {
    return NULL;
  }

  if ( !init_done ) {
    if ( err = buffer_init( &work, 256, 64 ), ERR_None != err ) {
      nomem(  );
    }
    if ( err = hash_new( 1000, &cache ), ERR_None != err ) {
      nomem(  );
    }
    init_done = 1;
  }

  sz = sizeof( where ) + strlen( file ) + 1;
  if ( err = buffer_ensure( &work, sz ), ERR_None != err ) {
    nomem(  );
  }

  w = ( where * ) work.buf;
  w->line = line;
  strcpy( ( char * ) ( w + 1 ), file );

  /* Already got it? */
  if ( w = ( where * ) hash_get( cache, w, sz ), NULL != w ) {
    return w;
  }

  if ( w = malloc( sz ), !w ) {
    nomem(  );
  }

  memcpy( w, work.buf, sz );

  /* Add it to cache */
  if ( err = hash_put( cache, w, sz, w ), ERR_None != err ) {
    nomem(  );
  }

  return w;
}
Exemple #8
0
static void
brute_force( int line, const char *file ) {
  SV *sva;
  hash *baby;
  const where *w;
  int err;

  fprintf( stderr, "brute_force(%d, \"%s\")\n", line, file );

  w = get_where( line, file );

  if ( err = hash_new( PL_sv_count, &baby ), ERR_None != err ) {
    nomem(  );
  }

  for ( sva = PL_sv_arenaroot; sva; sva = ( SV * ) SvANY( sva ) ) {
    SV *sv = sva + 1;
    SV *svend = &sva[SvREFCNT( sva )];

    while ( sv < svend ) {
      if ( live_sv( sv ) ) {
        const where *nw = w;

        if ( brute ) {
          const where *ow;
          if ( ( ow = hash_get( brute, &sv, sizeof( sv ) ) ) ) {
            nw = hash_GETNULL( ow );
          }
          else {
            if ( w ) {
              fprintf( stderr,
                       "%s, line %d: New var (bf): %p\n",
                       ( const char * ) ( w + 1 ), w->line, sv );
            }
          }
        }

        if ( err = hash_put( baby, &sv, sizeof( sv ),
                             hash_PUTNULL( ( void * ) nw ) ),
             ERR_None != err ) {
          nomem(  );
        }
      }
      ++sv;
    }
  }

  hash_delete( brute );
  brute = baby;
}
Exemple #9
0
static void
note_new_vars( int line, const char *file ) {
  list new_arenas;
  list new_free;
  int err;
  const where *w;

  if ( !file ) {
    return;
  }
#ifdef SANITY
  free_list_sane(  );
#endif

  w = get_where( line, file );

  /*fprintf(stderr, "note_new_vars(%d, \"%s\")\n", line, file); */

  if ( err =
       list_build( &new_arenas, PL_sv_arenaroot,
                   list_hint( &current_arenas ) ), ERR_None != err ) {
    nomem(  );
  }

  if ( err =
       list_build( &new_free, PL_sv_root, list_hint( &current_free ) ),
       ERR_None != err ) {
    nomem(  );
  }

  if ( note_init_done ) {
    /* Scan the lists looking for new arenas and deleted
     * free slots. A deleted free slot implies the creation of a new
     * variable.
     */

    list_true_diff( &current_arenas, &new_arenas, w, new_arena,
                    free_arena );
    list_true_diff( &new_free, &current_free, w, new_var, free_var );

    list_delete( &current_arenas );
    list_delete( &current_free );
  }

  /* Roll round to new versions of lists */
  current_arenas = new_arenas;
  current_free = new_free;
  note_init_done = 1;
}
Exemple #10
0
/* Sanity check - compare the free list with the list of free SVs in the arenas */
static void
free_list_sane( void ) {
  list real_free;
  list comp_free;
  int err;
  SV *sva;
  long diff;

  /* Get the real free list */
  if ( err =
       list_build( &real_free, PL_sv_root, list_hint( &current_free ) ),
       ERR_None != err ) {
    nomem(  );
  }

  /* Get the list of all the free SVs in all the arenas */
  if ( err =
       list_init( &comp_free, list_hint( &real_free ) ),
       ERR_None != err ) {
    nomem(  );
  }

  for ( sva = PL_sv_arenaroot; sva; sva = ( SV * ) SvANY( sva ) ) {
    SV *sv = sva + 1;
    SV *svend = &sva[SvREFCNT( sva )];

    while ( sv < svend ) {
      if ( free_sv( sv ) ) {
        if ( err = list_append( &comp_free, sv ), ERR_None != err ) {
          nomem(  );
        }
      }
      ++sv;
    }
  }

  diff =
      list_true_diff( &real_free, &comp_free, NULL, in_free_only,
                      in_comp_only );

  if ( diff != 0 ) {
    fprintf( stderr, "Lists have %ld differences, stopping\n", diff );
    fprintf( stderr,
             "%ld items in free list, %ld free items in arenas\n",
             ( long ) list_used( &real_free ),
             ( long ) list_used( &comp_free ) );
    exit( 1 );
  }
}
Exemple #11
0
void
SamplingItem::resetValues(int values, double, double)
{
    size_t size;

    // Reset sizes of pcp data array and the plot data array
    size = values * sizeof(my.data[0]);
    if ((my.data = (double *)realloc(my.data, size)) == NULL)
	nomem();
    size = values * sizeof(my.itemData[0]);
    if ((my.itemData = (double *)realloc(my.itemData, size)) == NULL)
	nomem();
    if (my.dataCount > values)
	my.dataCount = values;
}
Exemple #12
0
int main(int argc, char **argv) {
  char *to, **arg, *s=0;
  if (argc<2) { die(100,"usage: install-bin Dir < File\n  "
    "install-bin Dir  c:::755:mid:file::  x:::755:mid:name:source:  ...\n"
    "File contains lines:\ntype:uid:gid:mode:middle:target:source:\n"
    "type is one of the letters: vpdcxg\n"
    "type g sets global uid:gid:mode:middle\n"); }

  to = argv[1];
  errmsg_iam("install-bin");
  umask(077);
  
  if (argc == 2) {
    int len;
    if (GLOBAL_READ(0,s, len,100000))  ex("read","stdin");
    close(0);
    s[len]=0;
    
    len = splitmem(0,s,'\n');
    arg = alloca((len+1) * sizeof(char*)); if (arg==0) nomem();
    splitmem(arg,s,'\n');
  } else
    arg = argv+2;

  for (; (s=*arg); ++arg) doit(to, s);
  return 0;
}
Exemple #13
0
TimeControl::TimeControl() : QProcess(NULL)
{
    my.tcpPort = -1;
    my.tzLength = 0;
    my.tzData = NULL;
    my.bufferLength = sizeof(QmcTime::Packet);

    my.buffer = (char *)malloc(my.bufferLength);
    my.livePacket = (QmcTime::Packet *)malloc(sizeof(QmcTime::Packet));
    my.archivePacket = (QmcTime::Packet *)malloc(sizeof(QmcTime::Packet));
    if (!my.buffer || !my.livePacket || !my.archivePacket)
	nomem();
    my.livePacket->magic = QmcTime::Magic;
    my.livePacket->source = QmcTime::HostSource;
    my.liveState = TimeControl::Disconnected;
    my.liveSocket = new QTcpSocket(this);
    connect(my.liveSocket, SIGNAL(connected()),
				SLOT(liveSocketConnected()));
    connect(my.liveSocket, SIGNAL(disconnected()),
				SLOT(liveCloseConnection()));
    connect(my.liveSocket, SIGNAL(readyRead()),
				SLOT(liveProtocolMessage()));

    my.archivePacket->magic = QmcTime::Magic;
    my.archivePacket->source = QmcTime::ArchiveSource;
    my.archiveState = TimeControl::Disconnected;
    my.archiveSocket = new QTcpSocket(this);
    connect(my.archiveSocket, SIGNAL(connected()),
				SLOT(archiveSocketConnected()));
    connect(my.archiveSocket, SIGNAL(disconnected()),
				SLOT(archiveCloseConnection()));
    connect(my.archiveSocket, SIGNAL(readyRead()),
				SLOT(archiveProtocolMessage()));
}
Exemple #14
0
void PmQuery::addMessage(char *string)
{
    messages = (char **)realloc(messages, (messagecount+1) * sizeof(char *));
    if (!messages)
	nomem();
    messages[messagecount++] = string;
}
Exemple #15
0
/*
 * Store a type and it's type string so we can later share this type
 * if we read the same type string from the input file.
 */
static u_short
storetyp(type_t *tp, const char *cp, size_t len, int h)
{
	static	u_int	tidx = 1;	/* 0 is reserved */
	thtab_t	*thte;
	char	*name;

	if (tidx >= USHRT_MAX)
		errx(1, "sorry, too many types");

	if (tidx == tlstlen - 1) {
		if ((tlst = realloc(tlst, (tlstlen * 2) * sizeof (type_t *)))
		    == NULL)
			nomem();
		(void)memset(tlst + tlstlen, 0, tlstlen * sizeof (type_t *));
		tlstlen *= 2;
	}

	tlst[tidx] = tp;

	/* create a hash table entry */
	name = xalloc(len + 1);
	(void)memcpy(name, cp, len);
	name[len] = '\0';

	thte = xalloc(sizeof (thtab_t));
	thte->th_name = name;
	thte->th_idx = tidx;
	thte->th_nxt = thtab[h];
	thtab[h] = thte;

	return ((u_short)tidx++);
}
static void
gdbsim_load (char *args, int fromtty)
{
  char **argv = buildargv (args);
  char *prog;

  if (argv == NULL)
    nomem (0);

  make_cleanup_freeargv (argv);

  prog = tilde_expand (argv[0]);

  if (argv[1] != NULL)
    error (_("GDB sim does not yet support a load offset."));

  if (sr_get_debug ())
    printf_filtered ("gdbsim_load: prog \"%s\"\n", prog);

  /* FIXME: We will print two messages on error.
     Need error to either not print anything if passed NULL or need
     another routine that doesn't take any arguments.  */
  if (sim_load (gdbsim_desc, prog, NULL, fromtty) == SIM_RC_FAIL)
    error (_("unable to load program"));

  /* FIXME: If a load command should reset the targets registers then
     a call to sim_create_inferior() should go here. */

  program_loaded = 1;
}
Exemple #17
0
struct s_node *mklit(char *t) {
    struct s_node *r;
    r = s_new(lit);
    if (!r) nomem();
    r->text = t;
    return r;
}
Exemple #18
0
struct s_node *mkseq(struct s_node *l) {
    struct s_node *r;
    r = s_new(seq);
    if (!r) nomem();
    r->first = l;
    return r;
}
Exemple #19
0
static void
exec_file_command (char *args, int from_tty)
{
  char **argv;
  char *filename;

  if (from_tty && target_has_execution
      && !query (_("A program is being debugged already.\n"
		   "Are you sure you want to change the file? ")))
    error (_("File not changed."));

  if (args)
    {
      /* Scan through the args and pick up the first non option arg
         as the filename.  */

      argv = buildargv (args);
      if (argv == NULL)
        nomem (0);

      make_cleanup_freeargv (argv);

      for (; (*argv != NULL) && (**argv == '-'); argv++)
        {;
        }
      if (*argv == NULL)
        error (_("No executable file name was specified"));

      filename = tilde_expand (*argv);
      make_cleanup (xfree, filename);
      exec_file_attach (filename, from_tty);
    }
  else
    exec_file_attach (NULL, from_tty);
}
void rotate2D(float *data,fdf_header *hdr,int dir) {
  int    r,p,pixel,pixelud;
  float *dataud;
  
  /*
  if (hdr->ro_size != hdr->pe_size) {
    printf("Sorry, don't know how to handle rectangular images (%.f x %.f)",hdr->ro_size,hdr->pe_size);
    exit(0);
  }
  */
     
  if ((dataud = (float *)malloc(hdr->datasize*sizeof(float))) == NULL) nomem();

  for (r = 0; r < hdr->ro_size; r++) {
    for (p = 0; p < hdr->pe_size; p++) {
      pixel   = r*hdr->pe_size + p;
      if (dir == -1) //rotate counter-clockwise
	//  	pixelud = p*hdr->ro_size + (hdr->pe_size - r - 1);
  	pixelud = p*hdr->ro_size + (hdr->ro_size - r - 1);
      else //rotate clockwise
	//  	pixelud = (hdr->pe_size-p-1)*hdr->pe_size + r;
  	pixelud = (hdr->pe_size-p-1)*hdr->ro_size + r;
      dataud[pixelud] = data[pixel];
    }
  }


  /* Put it back in original image */
  for (pixel = 0; pixel < hdr->datasize; pixel++) 
    data[pixel] = dataud[pixel];

  free(dataud);
}
Exemple #21
0
struct s_node *mkcall(char *name) {
    struct s_node *r;
    r = s_new(call);
    if (!r) nomem();
    r->text = name;
    return r;
}
Exemple #22
0
/*
 * Return 1 if "ignore" appears in the options string
 */
int
ignore(char *opts)
{
	char *value;
	char *saveptr, *my_opts;
	int rval = 0;

	if (opts == NULL || *opts == NULL)
		return (0);

	/*
	 * we make a copy of the option string to pass to getsubopt(),
	 * because getsubopt() modifies the string.  We also save
	 * the original pointer returned by strdup, because getsubopt
	 * changes the pointer passed into it.  If strdup fails (unlikely),
	 * we act as if the "ignore" option isn't set rather than fail.
	 */

	if ((saveptr = my_opts = strdup(opts)) == NULL)
		nomem();

	while (*my_opts != '\0') {
		if (getsubopt(&my_opts, mntopts, &value) == IGNORE)
			rval = 1;
	}

	free(saveptr);

	return (rval);
}
Exemple #23
0
char *s_stash_type(struct s_node *type_list) {
    char *typ = 0;
    int typ_len = 0;
    struct s_node *p;

    for (p = type_list; p; p = p->next) {
        void *x;

        typ_len += strlen(p->text) + 1;
        x = realloc(typ, typ_len);
        if (!x) nomem();
        typ = x;

        if (p == type_list)
            strcpy(typ, p->text);
        else {
            strcat(typ, " ");
            strcat(typ, p->text);
        }
    }
    typ[typ_len - 1] = '\0';

    t = typ;
    return t;
}
Exemple #24
0
mess822_action *init(int n,char **s)
{
	int i;
	mess822_action *a1;

	if (!n) return a0;

	a1 = (mess822_action *)alloc((n + 1) * sizeof(mess822_action));
	if (!a1) nomem();

	for (i = 0;i < n;i++) {
		a1[i].name = *s;
		a1[i].flag = &flag;
		a1[i].copy = 0;
		a1[i].value = 0;
		a1[i].addr = &addr;
		a1[i].when = 0;
		++s;
	}
	a1[n].name = 0;
	a1[n].flag = 0;
	a1[n].copy = 0;
	a1[n].value = 0;
	a1[n].addr = 0;
	a1[n].when = 0;

	return a1;
}
Exemple #25
0
static void
new_arena( SV * sva, const void *p ) {
  const where *w = p;
  int err;
  /*fprintf(stderr, "%s, line %d: New arena: %p\n", (const char *) (w + 1), w->line, sva); */
  SV *sv = sva + 1;
  SV *svend = &sva[SvREFCNT( sva )];

  while ( sv < svend ) {
    if ( live_sv( sv ) ) {
      /* New variable */
      new_var( sv, w );
    }
    else {
      /* Pretend any new free SVs were already in the free list otherwise
       * when we compare the new free list with the old one it'll look as
       * if lots of variables that never existed have been freed.
       */
      if ( err = list_append( &current_free, sv ), ERR_None != err ) {
        nomem(  );
      }
    }
    ++sv;
  }
  /*fprintf(stderr, "%s, line %d: End new arena: %p\n", (const char *) (w + 1), w->line, sva); */
}
Exemple #26
0
//void do_sender(const char *s)
void do_sender(char *s)
{
  char *x;
  int n;
  int a;
  int i;

  env_unset("QMAILNAME");
  env_unset("MAILNAME");
  env_unset("NAME");
  env_unset("QMAILHOST");
  env_unset("MAILHOST");

  n = str_len(s);
  a = str_rchr(s, '@');
  if (a == n)
  {
    env_put("QMAILUSER", s);
    return;
  }
  env_put("QMAILHOST",s + a + 1);

  x = (char *) alloc((a + 1) * sizeof(char));
  if (!x) nomem();
  for (i = 0; i < a; i++)
    x[i] = s[i];
  x[i] = 0;
  env_put("QMAILUSER", x);
  alloc_free(x);
}
Exemple #27
0
//--------------------------------------------------------------------------
static void load_dl_header(linput_t *li)
{
  if ( first_text_subspace_fpos == -1 ) return;
  qlseek(li, first_text_subspace_fpos);
  dl_header dl;
  lread(li, &dl, sizeof(dl));
  dl.swap();
  switch ( dl.hdr_version )
  {
    case OLD_HDR_VERSION: break;
    case HDR_VERSION    : break;
    default:
      msg("Unknown DL header version, skipping...\n");
  }
  if ( dl.string_table_size != 0 )
  {
    dl_ssize = dl.string_table_size;
    dl_strings = (char *)qalloc(dl_ssize);
    if ( dl_strings == NULL ) nomem("dl_strings");
    qlseek(li, first_text_subspace_fpos+dl.string_table_loc);
    lread(li, dl_strings, dl_ssize);
  }
  if ( dl.dreloc_count ) complain_fixup();

  load_imports(li, dl);
  load_exports(li, dl);

  qfree(dl_strings);
  dl_strings = NULL;
}
Exemple #28
0
static int
runops_leakcheck( pTHX ) {
  char *lastfile = NULL;
  int lastline = 0;

  while ( ( PL_op = CALL_FPTR( PL_op->op_ppaddr ) ( aTHX ) ) ) {
    PERL_ASYNC_CHECK(  );

    if ( interesting_op( PL_op->op_type ) ) {
      /*fprintf(stderr, "%s, line %d\n", lastfile, lastline); */
      NOTE_NEW_VARS( lastline, lastfile );
      free( lastfile );
      if ( lastfile = strdup( CopFILE( cCOP ) ), NULL == lastfile ) {
        nomem(  );
      }
      lastline = CopLINE( cCOP );
    }
  }

  /*fprintf(stderr, "%s, line %d\n", lastfile, lastline); */
  NOTE_NEW_VARS( lastline, lastfile );

  free( lastfile );

  TAINT_NOT;
  return 0;
}
Exemple #29
0
void
tools_reset_counters( void ) {
  int err;

  hash_delete( var_map );
  var_map = NULL;

  /*fprintf(stderr, "\nNew var_map\n\n"); */

  if ( err = hash_new( 1000, &var_map ), ERR_None != err ) {
    nomem(  );
  }

  list_delete( &current_arenas );
  list_delete( &current_free );
  note_init_done = 0;

  note_new_vars( 0, NULL );

#ifdef BRUTE_FORCE
  hash_delete( brute );
  brute = NULL;
  brute_force( 0, NULL );
#endif
}
Exemple #30
0
struct s_node *mkalt(struct s_node *l) {
    struct s_node *r;
    r = s_new(alt);
    if (!r) nomem();
    r->first = l;
    return r;
}