コード例 #1
0
ファイル: sb.c プロジェクト: 5432935/crossbridge
static void
sb_check (sb *ptr, int len)
{
  if (ptr->len + len >= 1 << ptr->pot)
    {
      sb tmp;
      int pot = ptr->pot;

      while (ptr->len + len >= 1 << pot)
	pot++;
      sb_build (&tmp, pot);
      sb_add_sb (&tmp, ptr);
      sb_kill (ptr);
      *ptr = tmp;
    }
}
コード例 #2
0
ファイル: input-scrub.c プロジェクト: Distrotech/binutils
void
input_scrub_include_sb (sb *from, char *position, int is_expansion)
{
  int newline;

  if (macro_nest > max_macro_nest)
    as_fatal (_("macros nested too deeply"));
  ++macro_nest;

#ifdef md_macro_start
  if (is_expansion)
    {
      md_macro_start ();
    }
#endif

  next_saved_file = input_scrub_push (position);

  /* Allocate sufficient space: from->len + optional newline.  */
  newline = from->len >= 1 && from->ptr[0] != '\n';
  sb_build (&from_sb, from->len + newline);
  from_sb_is_expansion = is_expansion;
  if (newline)
    {
      /* Add the sentinel required by read.c.  */
      sb_add_char (&from_sb, '\n');
    }
  sb_scrub_and_add_sb (&from_sb, from);

  /* Make sure the parser looks at defined contents when it scans for
     e.g. end-of-line at the end of a macro.  */
  sb_terminate (&from_sb);

  sb_index = 1;

  /* These variables are reset by input_scrub_push.  Restore them
     since we are, after all, still at the same point in the file.  */
  logical_input_line = next_saved_file->logical_input_line;
  logical_input_file = next_saved_file->logical_input_file;
}
コード例 #3
0
ファイル: sb.c プロジェクト: 5432935/crossbridge
void
sb_new (sb *ptr)
{
  sb_build (ptr, dsize);
}
コード例 #4
0
void
sb_new (sb *ptr)
{
  sb_build (ptr, INIT_ALLOC);
}