コード例 #1
0
/* Initialize the msgtab parsing tree -orabidoo
 */
void init_tree_parse(struct Message *mptr)
{
  int i;
  struct Message *mpt = mptr;

  for (i=0; mpt->cmd; mpt++)
    i++;
  qsort((void *)mptr, i, sizeof(struct Message), 
                (int (*)(const void *, const void *)) mcmp);
  expect_malloc;
  msg_tree_root = (MESSAGE_TREE *)MyMalloc(sizeof(MESSAGE_TREE));
  malloc_log("init_tree_parse() allocating MESSAGE_TREE (%zd bytes) at %p",
             sizeof(MESSAGE_TREE), (void *)msg_tree_root);
  mpt = do_msg_tree(msg_tree_root, "", mptr);

  /*
   * this happens if one of the msgtab entries included characters
   * other than capital letters  -orabidoo
   */
  if (mpt->cmd)
    {
      logprintf(L_CRIT, "bad msgtab entry: ``%s''\n", mpt->cmd);
      exit(1);
    }
}
コード例 #2
0
ファイル: parse.c プロジェクト: pombredanne/solidircd
/* Initialize the msgtab parsing tree -orabidoo */
void init_tree_parse(struct Message *mptr)
{
    int i;
    struct Message *mpt = mptr;
    
    for (i = 0; mpt->cmd; mpt++)
	i++;
    qsort((void *) mptr, i, sizeof(struct Message),
	  (int (*)(const void *, const void *)) mcmp);
    
    msg_tree_root = (MESSAGE_TREE *) MyMalloc(sizeof(MESSAGE_TREE));
    num_msg_trees++;
    mpt = do_msg_tree(msg_tree_root, "", mptr);
    /*
     * this happens if one of the msgtab entries included characters
     * other than capital letters  -orabidoo
     */
    if (mpt->cmd)
    {
	fprintf(stderr, "bad msgtab entry: ``%s''\n", mpt->cmd);
	exit(1);
    }
}