• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ NONULL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NONULL函数的典型用法代码示例。如果您正苦于以下问题:C++ NONULL函数的具体用法?C++ NONULL怎么用?C++ NONULL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NONULL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: mutt_mkwrapdir

static int mutt_mkwrapdir (const char *path, char *newfile, size_t nflen, 
		    char *newdir, size_t ndlen)
{
  const char *basename;
  char parent[_POSIX_PATH_MAX];
  char *p;

  strfcpy (parent, NONULL (path), sizeof (parent));
  
  if ((p = strrchr (parent, '/')))
  {
    *p = '\0';
    basename = p + 1;
  }
  else
  {
    strfcpy (parent, ".", sizeof (parent));
    basename = path;
  }

  snprintf (newdir, ndlen, "%s/%s", parent, ".muttXXXXXX");
  if (mkdtemp(newdir) == NULL)
  {
      dprint(1, (debugfile, "mutt_mkwrapdir: mkdtemp() failed\n"));
      return -1;
  }
  
  if (snprintf (newfile, nflen, "%s/%s", newdir, NONULL(basename)) >= nflen)
  {
      rmdir(newdir);
      dprint(1, (debugfile, "mutt_mkwrapdir: string was truncated\n"));
      return -1;
  }
  return 0;  
}
开发者ID:SteveClement,项目名称:mutt,代码行数:35,代码来源:lib.c


示例2: mutt_addrlist_to_local

int mutt_addrlist_to_local (ADDRESS *a)
{
  char *user, *domain;
  char *tmp = NULL;
  
  for (; a; a = a->next)
  {
    if (!a->mailbox)
      continue;
    if (!check_idn (a))
      continue;
    if (mbox_to_udomain (a->mailbox, &user, &domain) == -1)
      continue;
    if (mutt_idna_to_local (domain, &tmp, 0) == 0)
    {
      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
      sprintf (a->mailbox, "%[email protected]%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */
      a->idn_checked = 0;
    }
    
    FREE (&tmp);
  }
  
  return 0;
}
开发者ID:2ion,项目名称:mutt-1.5.22,代码行数:25,代码来源:mutt_idna.c


示例3: FREE

/* convert just for displaying purposes */
const char *mutt_addr_for_display (ADDRESS *a)
{
  static char *buff = NULL;
  char *tmp = NULL;
  /* user and domain will be either allocated or reseted to the NULL in
   * the mbox_to_udomain(), but for safety... */
  char *domain = NULL;
  char *user = NULL;
  
  FREE (&buff);

  if (!check_idn (a))
    return a->mailbox;
  if (mbox_to_udomain (a->mailbox, &user, &domain) != 0)
    return a->mailbox;
  if (mutt_idna_to_local (domain, &tmp, MI_MAY_BE_IRREVERSIBLE) != 0)
  {
    FREE (&tmp);
    return a->mailbox;
  }
  
  safe_realloc (&buff, mutt_strlen (tmp) + mutt_strlen (user) + 2);
  sprintf (buff, "%[email protected]%s", NONULL(user), NONULL(tmp)); /* __SPRINTF_CHECKED__ */
  FREE (&tmp);
  return buff;
}
开发者ID:2ion,项目名称:mutt-1.5.22,代码行数:27,代码来源:mutt_idna.c


示例4: mutt_mkwrapdir

static int mutt_mkwrapdir (const char *path, char *newfile, size_t nflen, 
		    char *newdir, size_t ndlen)
{
  const char *basename;
  char parent[_POSIX_PATH_MAX];
  char *p;
  int rv;

  strfcpy (parent, NONULL (path), sizeof (parent));
  
  if ((p = strrchr (parent, '/')))
  {
    *p = '\0';
    basename = p + 1;
  }
  else
  {
    strfcpy (parent, ".", sizeof (parent));
    basename = path;
  }

  do 
  {
    snprintf (newdir, ndlen, "%s/%s", parent, ".muttXXXXXX");
    mktemp (newdir);
  } 
  while ((rv = mkdir (newdir, 0700)) == -1 && errno == EEXIST);
  
  if (rv == -1)
    return -1;
  
  snprintf (newfile, nflen, "%s/%s", newdir, NONULL(basename));
  return 0;  
}
开发者ID:Wuodan,项目名称:mutt-kz,代码行数:34,代码来源:lib.c


示例5: mutt_fqdn

ADDRESS *mutt_default_from (void)
{
  ADDRESS *adr;
  const char *fqdn = mutt_fqdn(1);

  /* 
   * Note: We let $from override $realname here.  Is this the right
   * thing to do? 
   */

  if (From)
    adr = rfc822_cpy_adr_real (From);
  else if (option (OPTUSEDOMAIN))
  {
    adr = rfc822_new_address ();
    adr->mailbox = safe_malloc (mutt_strlen (Username) + mutt_strlen (fqdn) + 2);
    sprintf (adr->mailbox, "%[email protected]%s", NONULL(Username), NONULL(fqdn));	/* __SPRINTF_CHECKED__ */
  }
  else
  {
    adr = rfc822_new_address ();
    adr->mailbox = safe_strdup (NONULL(Username));
  }
  
  return (adr);
}
开发者ID:Ishpeck,项目名称:mutt-kz,代码行数:26,代码来源:send.c


示例6: _mutt_mktemp

void _mutt_mktemp (char *s, const char *src, int line)
{

  snprintf (s, _POSIX_PATH_MAX, "%s/muttng-%s-%d-%d-%d-%x%x", NONULL (Tempdir),
            NONULL (Hostname), (int) getuid (), (int) getpid (), Counter++, 
            (unsigned int) rand(), (unsigned int) rand());
  debug_print (1, ("%s:%d: mutt_mktemp returns \"%s\".\n", src, line, s));
  unlink (s);
}
开发者ID:BackupTheBerlios,项目名称:mutt-ng-svn,代码行数:9,代码来源:muttlib.c


示例7: mutt_strxcmp

int mutt_strxcmp(const char *a, const char *b)
{
  size_t xa, xb;
  xa = strcspn(NONULL(a), "\r\n");
  xb = strcspn(NONULL(b), "\r\n");
  if (xb != xa)
    return -1;
  if (!xa)
    return 0;
  return strncmp(NONULL(a), NONULL(b), xa);
}
开发者ID:twoerner,项目名称:susemutt,代码行数:11,代码来源:lib.c


示例8: query_format_str

static const char * query_format_str (char *dest, size_t destlen, size_t col,
char op, const char *src,
const char *fmt, const char *ifstring,
const char *elsestring,
unsigned long data, format_flag flags)
{
        ENTRY *entry = (ENTRY *)data;
        QUERY *query = entry->data;
        char tmp[SHORT_STRING];
        char buf2[STRING] = "";
        int optional = (flags & M_FORMAT_OPTIONAL);

        switch (op) {
                case 'a':
                        rfc822_write_address (buf2, sizeof (buf2), query->addr, 1);
                        snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
                        snprintf (dest, destlen, tmp, buf2);
                        break;
                case 'c':
                        snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
                        snprintf (dest, destlen, tmp, query->num + 1);
                        break;
                case 'e':
                        if (!optional) {
                                snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
                                snprintf (dest, destlen, tmp, NONULL (query->other));
                        }
                        else if (!query->other || !*query->other)
                                optional = 0;
                        break;
                case 'n':
                        snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
                        snprintf (dest, destlen, tmp, NONULL (query->name));
                        break;
                case 't':
                        snprintf (tmp, sizeof (tmp), "%%%sc", fmt);
                        snprintf (dest, destlen, tmp, entry->tagged ? '*' : ' ');
                        break;
                default:
                        snprintf (tmp, sizeof (tmp), "%%%sc", fmt);
                        snprintf (dest, destlen, tmp, op);
                        break;
        }

        if (optional)
                mutt_FormatString (dest, destlen, col, ifstring, query_format_str, data, 0);
        else if (flags & M_FORMAT_OPTIONAL)
                mutt_FormatString (dest, destlen, col, elsestring, query_format_str, data, 0);

        return src;
}
开发者ID:tejux,项目名称:mutt-hacks,代码行数:51,代码来源:query.c


示例9: test_string_set

static bool test_string_set(struct ConfigSet *cs, struct Buffer *err)
{
  log_line(__func__);

  const char *valid[] = { "[email protected]", "[email protected]", NULL };
  const char *name = "Damson";
  char *addr = NULL;

  int rc;
  for (unsigned int i = 0; i < mutt_array_size(valid); i++)
  {
    mutt_buffer_reset(err);
    rc = cs_str_string_set(cs, name, valid[i], err);
    if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
    {
      TEST_MSG("%s\n", err->data);
      return false;
    }

    addr = VarDamson ? VarDamson->mailbox : NULL;
    if (!TEST_CHECK(mutt_str_strcmp(addr, valid[i]) == 0))
    {
      TEST_MSG("Value of %s wasn't changed\n", name);
      return false;
    }
    TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(addr), NONULL(valid[i]));
  }

  name = "Elderberry";
  for (unsigned int i = 0; i < mutt_array_size(valid); i++)
  {
    mutt_buffer_reset(err);
    rc = cs_str_string_set(cs, name, valid[i], err);
    if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
    {
      TEST_MSG("%s\n", err->data);
      return false;
    }

    addr = VarElderberry ? VarElderberry->mailbox : NULL;
    if (!TEST_CHECK(mutt_str_strcmp(addr, valid[i]) == 0))
    {
      TEST_MSG("Value of %s wasn't changed\n", name);
      return false;
    }
    TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(addr), NONULL(valid[i]));
  }

  log_line(__func__);
  return true;
}
开发者ID:darnir,项目名称:neomutt,代码行数:51,代码来源:address.c


示例10: dump_native

static void dump_native(struct ConfigSet *cs, const char *parent, const char *child)
{
  intptr_t pval = cs_str_native_get(cs, parent, NULL);
  intptr_t cval = cs_str_native_get(cs, child, NULL);

  struct Address *pa = (struct Address *) pval;
  struct Address *ca = (struct Address *) cval;

  char *pstr = pa ? pa->mailbox : NULL;
  char *cstr = ca ? ca->mailbox : NULL;

  TEST_MSG("%15s = %s\n", parent, NONULL(pstr));
  TEST_MSG("%15s = %s\n", child, NONULL(cstr));
}
开发者ID:darnir,项目名称:neomutt,代码行数:14,代码来源:address.c


示例11: DEBUGPRINT

void Event::_unsetContext (const char* file, int line) {
  Event::context context;

  context = contextStack->back ();
  contextStack->pop_back ();
  DEBUGPRINT(D_EVENT,("leave ctx=%s from %s:%d", CtxStr[context],
                      NONULL (file), line));
  sigContextChange.emit (context, E_CONTEXT_LEAVE);
  if (contextStack->size () != 0) {
    context = contextStack->back ();
    DEBUGPRINT(D_EVENT,("re-enter ctx=%s from %s:%d", CtxStr[context],
                  NONULL (file), line));
    sigContextChange.emit (context, E_CONTEXT_REENTER);
  }
}
开发者ID:BackupTheBerlios,项目名称:mutt-ng-svn,代码行数:15,代码来源:event.cpp


示例12: test_native_set

static bool test_native_set(struct ConfigSet *cs, struct Buffer *err)
{
  log_line(__func__);

  struct Address *a = address_new("[email protected]");
  const char *name = "Ilama";
  char *addr = NULL;
  bool result = false;

  mutt_buffer_reset(err);
  int rc = cs_str_native_set(cs, name, (intptr_t) a, err);
  if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
  {
    TEST_MSG("%s\n", err->data);
    goto tbns_out;
  }

  addr = VarIlama ? VarIlama->mailbox : NULL;
  if (!TEST_CHECK(mutt_str_strcmp(addr, a->mailbox) == 0))
  {
    TEST_MSG("Value of %s wasn't changed\n", name);
    goto tbns_out;
  }
  TEST_MSG("%s = '%s', set by '%s'\n", name, NONULL(addr), a->mailbox);

  name = "Jackfruit";
  mutt_buffer_reset(err);
  rc = cs_str_native_set(cs, name, 0, err);
  if (!TEST_CHECK(CSR_RESULT(rc) == CSR_SUCCESS))
  {
    TEST_MSG("%s\n", err->data);
    goto tbns_out;
  }

  if (!TEST_CHECK(VarJackfruit == NULL))
  {
    TEST_MSG("Value of %s wasn't changed\n", name);
    goto tbns_out;
  }
  addr = VarJackfruit ? VarJackfruit->mailbox : NULL;
  TEST_MSG("%s = '%s', set by NULL\n", name, NONULL(addr));

  log_line(__func__);
  result = true;
tbns_out:
  address_free(&a);
  return result;
}
开发者ID:darnir,项目名称:neomutt,代码行数:48,代码来源:address.c


示例13: apply_config

static void
apply_config(void)
{
   char                buff[1024];

   if (show_title)
     {
	Epplet_gadget_move(in_label, 3, 13);
	Epplet_gadget_move(out_label, 3, 30);
	Epplet_gadget_move(in_bar, 3, 22);
	Epplet_gadget_move(out_bar, 3, 39);
	Epplet_gadget_show(title);
     }
   else
     {
	Epplet_gadget_move(in_label, 4, 4);
	Epplet_gadget_move(out_label, 4, 24);
	Epplet_gadget_move(in_bar, 4, 14);
	Epplet_gadget_move(out_bar, 4, 36);
	Epplet_gadget_hide(title);
     }
   Epplet_modify_config("title", (show_title ? "1" : "0"));

   strcpy(buff, NONULL(Epplet_textbox_contents(cfg_tb_dev)));
   if (strcmp(buff, device_string))
     {
	Epplet_modify_config("dev", buff);
	device_string = Epplet_query_config("dev");
	last_in = last_out = 0;
     }

   timer_cb(NULL);
}
开发者ID:Limsik,项目名称:e17,代码行数:33,代码来源:E-Bandwidth.c


示例14: mutt_pgp_command

void mutt_pgp_command (char *d, size_t dlen, struct pgp_command_context *cctx,
                       const char *fmt)
{
  mutt_FormatString (d, dlen, NONULL (fmt), _mutt_fmt_pgp_command,
                     (unsigned long) cctx, 0);
  debug_print (2, ("%s\n", d));
}
开发者ID:BackupTheBerlios,项目名称:mutt-ng-svn,代码行数:7,代码来源:pgpinvoke.c


示例15: luaH_utf8_strlen

/* UTF-8 aware string length computing.
 * Returns the number of elements pushed on the stack. */
static gint
luaH_utf8_strlen(lua_State *L)
{
    const gchar *cmd  = luaL_checkstring(L, 1);
    lua_pushnumber(L, (ssize_t) g_utf8_strlen(NONULL(cmd), -1));
    return 1;
}
开发者ID:pawelz,项目名称:luakit,代码行数:9,代码来源:luah.c


示例16: mutt_adv_mktemp

/* Modified by blong to accept a "suggestion" for file name.  If
 * that file exists, then construct one with unique name but 
 * keep any extension.  This might fail, I guess.
 * Renamed to mutt_adv_mktemp so I only have to change where it's
 * called, and not all possible cases.
 */
void mutt_adv_mktemp (char *s, size_t l)
{
  char buf[_POSIX_PATH_MAX];
  char tmp[_POSIX_PATH_MAX];
  char *period;
  size_t sl;
  struct stat sb;
  
  strfcpy (buf, NONULL (Tempdir), sizeof (buf));
  mutt_expand_path (buf, sizeof (buf));
  if (s[0] == '\0')
  {
    snprintf (s, l, "%s/muttXXXXXX", buf);
    mktemp (s);
  }
  else
  {
    strfcpy (tmp, s, sizeof (tmp));
    mutt_sanitize_filename (tmp, 1);
    snprintf (s, l, "%s/%s", buf, tmp);
    if (lstat (s, &sb) == -1 && errno == ENOENT)
      return;
    if ((period = strrchr (tmp, '.')) != NULL)
      *period = 0;
    snprintf (s, l, "%s/%s.XXXXXX", buf, tmp);
    mktemp (s);
    if (period != NULL)
    {
      *period = '.';
      sl = mutt_strlen(s);
      strfcpy(s + sl, period, l - sl);
    }
  }
}
开发者ID:kbraga111,项目名称:muttassign6-ed.purp.only-,代码行数:40,代码来源:muttlib.c


示例17: mutt_account_match

/* mutt_account_match: compare account info (host/port/user) */
int mutt_account_match(const ACCOUNT* a1, const ACCOUNT* a2)
{
	const char* user = NONULL(Username);

	if (a1->type != a2->type)
		return 0;
	if (ascii_strcasecmp(a1->host, a2->host))
		return 0;
	if (a1->port != a2->port)
		return 0;

#if USE_IMAP
	if (a1->type == M_ACCT_TYPE_IMAP)
	{
		if (ImapUser)
			user = ImapUser;
	}
#endif
	if (a1->flags & a2->flags & M_ACCT_USER)
		return (!strcmp(a1->user, a2->user));
	if (a1->flags & M_ACCT_USER)
		return (!strcmp(a1->user, user));
	if (a2->flags & M_ACCT_USER)
		return (!strcmp(a2->user, user));

	return 1;
}
开发者ID:0xAX,项目名称:muttx,代码行数:28,代码来源:account.c


示例18: redraw_mix_line

static void redraw_mix_line (LIST *chain)
{
  int c;
  char *t;

  mvaddstr (HDR_MIX, 0,     "     Mix: ");

  if (!chain)
  {
    addstr ("<no chain defined>");
    clrtoeol ();
    return;
  }
  
  for (c = 12; chain; chain = chain->next)
  {
    t = chain->data;
    if (t && t[0] == '0' && t[1] == '\0')
      t = "<random>";
    
    if (c + mutt_strlen (t) + 2 >= COLS)
      break;

    addstr (NONULL(t));
    if (chain->next)
      addstr (", ");

    c += mutt_strlen (t) + 2;
  }
}
开发者ID:SteveClement,项目名称:mutt,代码行数:30,代码来源:compose.c


示例19: draw_envelope

static void draw_envelope (HEADER *msg, char *fcc)
{
  draw_envelope_addr (HDR_FROM, msg->env->from);
  draw_envelope_addr (HDR_TO, msg->env->to);
  draw_envelope_addr (HDR_CC, msg->env->cc);
  draw_envelope_addr (HDR_BCC, msg->env->bcc);
  mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
  mutt_paddstr (W, NONULL (msg->env->subject));
  draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
  mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
  mutt_paddstr (W, fcc);

  if (WithCrypto)
    redraw_crypt_lines (msg);

#ifdef MIXMASTER
  redraw_mix_line (msg->chain);
#endif

  SETCOLOR (MT_COLOR_STATUS);
  mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
  clrtoeol ();

  NORMAL_COLOR;
}
开发者ID:SteveClement,项目名称:mutt,代码行数:25,代码来源:compose.c


示例20: mutt_account_match

/* mutt_account_match: compare account info (host/port/user) */
int mutt_account_match(const ACCOUNT *a1, const ACCOUNT *a2)
{
    const char *user = NONULL(Username);

    if (a1->type != a2->type)
        return 0;

    if (ascii_strcasecmp(a1->host, a2->host))
        return 0;

    if (a1->port != a2->port)
        return 0;


#ifdef USE_POP

    if ((a1->type == M_ACCT_TYPE_POP)
        && PopUser)
        user = PopUser;
#endif /* ifdef USE_POP */

    if (a1->flags & a2->flags & M_ACCT_USER)
        return !strcmp(a1->user, a2->user);

    if (a1->flags & M_ACCT_USER)
        return !strcmp(a1->user, user);

    if (a2->flags & M_ACCT_USER)
        return !strcmp(a2->user, user);

    return 1;
}
开发者ID:badeip,项目名称:neomutt,代码行数:33,代码来源:account.cpp



注:本文中的NONULL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NOREF函数代码示例发布时间:2022-05-30
下一篇:
C++ NOKOGIRI_STR_NEW2函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap