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

C++ MyFree函数代码示例

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

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



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

示例1: del_msg_element

/** Remove a message from the lookup trie.
 * @param[in,out] mtree_p Trie node to remove command from.
 * @param[in] cmd Text of command to remove.
 */
struct MessageTree *
del_msg_element(struct MessageTree *mtree_p, char *cmd)
{
  int slot = *cmd & (MAXPTRLEN-1);

  /* Either remove leaf message or from appropriate child. */
  if (*cmd == '\0')
    mtree_p->msg = NULL;
  else
    mtree_p->pointers[slot] = del_msg_element(mtree_p->pointers[slot], cmd + 1);

  /* If current message or any child still exists, keep this node. */
  if (mtree_p->msg)
    return mtree_p;
  for (slot = 0; slot < MAXPTRLEN; ++slot)
    if (mtree_p->pointers[slot])
      return mtree_p;

  /* Otherwise, if we're not a root node, free it and return null. */
  if (mtree_p != &msg_tree && mtree_p != &tok_tree)
    MyFree(mtree_p);
  return NULL;
}
开发者ID:andriesgroen,项目名称:nefarious2,代码行数:27,代码来源:parse.c


示例2: auth_timeout_callback

/*
 * auth_timeout - timeout a given auth request
 */
static void auth_timeout_callback(struct Event* ev)
{
  struct AuthRequest* auth;

  assert(0 != ev_timer(ev));
  assert(0 != t_data(ev_timer(ev)));

  auth = t_data(ev_timer(ev));

  if (ev_type(ev) == ET_DESTROY) { /* being destroyed */
    auth->flags &= ~AM_TIMEOUT;

    if (!(auth->flags & AM_FREE_MASK)) {
      Debug((DEBUG_LIST, "Freeing auth from timeout callback; %p [%p]", auth,
	     ev_timer(ev)));
      MyFree(auth); /* done with it, finally */
    }
  } else {
    assert(ev_type(ev) == ET_EXPIRE);

    destroy_auth_request(auth, 1);
  }
}
开发者ID:briancline,项目名称:virtuanet-ircu2.10.11.07,代码行数:26,代码来源:s_auth.c


示例3: uping_killer_callback

/** Timer callback to stop upings.
 * @param[in] ev Event for uping expiration.
 */
static void uping_killer_callback(struct Event* ev)
{
  struct UPing *pptr;

  assert(0 != ev_timer(ev));
  assert(0 != t_data(ev_timer(ev)));

  pptr = (struct UPing*) t_data(ev_timer(ev));

  Debug((DEBUG_SEND, "uping_killer_callback called, %p (%d)", pptr,
	 ev_type(ev)));

  if (ev_type(ev) == ET_DESTROY) { /* being destroyed */
    pptr->freeable &= ~UPING_PENDING_KILLER;

    if (!pptr->freeable)
      MyFree(pptr); /* done with it, finally */
  } else {
    assert(ev_type(ev) == ET_EXPIRE);

    uping_end(pptr); /* <FUDD>kill the uping, kill the uping!</FUDD> */
  }
}
开发者ID:DamnIO,项目名称:DamnIRCd,代码行数:26,代码来源:uping.c


示例4: uping_read_callback

/** Callback for socket activity on an outbound uping socket.
 * @param[in] ev I/O event for socket.
 */
static void uping_read_callback(struct Event* ev)
{
  struct UPing *pptr;

  assert(0 != ev_socket(ev));
  assert(0 != s_data(ev_socket(ev)));

  pptr = (struct UPing*) s_data(ev_socket(ev));

  Debug((DEBUG_SEND, "uping_read_callback called, %p (%d)", pptr,
	 ev_type(ev)));

  if (ev_type(ev) == ET_DESTROY) { /* being destroyed */
    pptr->freeable &= ~UPING_PENDING_SOCKET;

    if (!pptr->freeable)
      MyFree(pptr); /* done with it, finally */
  } else {
    assert(ev_type(ev) == ET_READ || ev_type(ev) == ET_ERROR);

    uping_read(pptr); /* read uping response */
  }
}
开发者ID:DamnIO,项目名称:DamnIRCd,代码行数:26,代码来源:uping.c


示例5: CompleteTransaction

/****************************************************************************
 *                                                                          *
 *  FUNCTION   : CompleteTransaction()                                      *
 *                                                                          *
 *  PURPOSE    : This handles completed synchronous and asynchronous        *
 *               transactions as well as failed attempted transactions.     *
 *                                                                          *
 *  RETURNS    : TRUE  - If successful.                                     *
 *               FALSE - otherwise.                                         *
 *                                                                          *
 ****************************************************************************/
VOID CompleteTransaction(
HWND hwndInfoCtrl,
XACT *pxact)
{
    PSTR psz;
    
    if (pxact->ret) {
        /*
         * Successful transaction case
         */
        SendMessage(hwndInfoCtrl, ICM_SETSTRING, ICSID_LL,
                (DWORD)(LPSTR)"Completed");
    
        if (pxact->wType == XTYP_REQUEST) {
            /*
             * Show resulting data
             */
            psz = GetTextData((HDDEDATA)pxact->ret);
            SendMessage(hwndInfoCtrl, ICM_SETSTRING, ICSID_CENTER,
                    (DWORD)(LPSTR)psz);
            MyFree(psz);
            /*
             * free returned data since it is displayed.
             */
            DdeFreeDataHandle(pxact->ret);
            pxact->ret = 0L;
            SendMessage(hwndInfoCtrl, ICM_SETSTRING, ICSID_UR, NULL);
        }
    } else {
        /*
         * failed - show error result.
         */
        SendMessage(hwndInfoCtrl, ICM_SETSTRING, ICSID_LL,
                (DWORD)(LPSTR)Error2String(DdeGetLastError(idInst)));
    }
    pxact->fsOptions |= XOPT_COMPLETED;
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:48,代码来源:dde.c


示例6: init_finish

static int init_finish(adns_state ads) {
  struct in_addr ia;
  int r;
  
  if (!ads->nservers) {
    if (ads->diagfile && ads->iflags & adns_if_debug)
      fprintf(ads->diagfile,"adns: no nameservers, using localhost\n");
    ia.s_addr= htonl(INADDR_LOOPBACK);
    addserver(ads,ia);
  }
  ads->udpsocket= socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
  if (ads->udpsocket<0) { r= errno; goto x_free; }

  r= adns__setnonblock(ads,ads->udpsocket);
  if (r) { r= errno; goto x_closeudp; }
  
  return 0;

 x_closeudp:
  close(ads->udpsocket);
 x_free:
  MyFree(ads);
  return r;
}
开发者ID:grawity,项目名称:ircd-hybrid-6,代码行数:24,代码来源:setup.c


示例7: MyZMalloc

void EDA_LibComponentStruct::SortDrawItems(void)
/*******************************************/
/* Trie les éléments graphiques d'un composant lib pour améliorer
le tracé:
items remplis en premier, pins en dernier
En cas de superposition d'items, c'est plus lisible
*/
{
LibEDA_BaseStruct ** Bufentry, ** BufentryBase, *Entry = m_Drawings;
int ii, nbitems;

	if(Entry == NULL ) return; /* Pas d'alias pour ce composant */
	/* calcul du nombre d'items */
	for( nbitems = 0; Entry != NULL; Entry = Entry->Next()) nbitems++;

	BufentryBase =
		(LibEDA_BaseStruct **) MyZMalloc( (nbitems+1) * sizeof(LibEDA_BaseStruct *));
	/* memorisation du chainage : */
	for( Entry = m_Drawings, ii = 0; Entry != NULL; Entry = Entry->Next())
		BufentryBase[ii++] = Entry;

	/* Tri du chainage */
	qsort(BufentryBase, nbitems, sizeof(LibEDA_BaseStruct *), SortItemsFct);

	/* Mise a jour du chainage. Remarque:
	le dernier element de BufEntryBase (BufEntryBase[nbitems]) est NULL*/
	m_Drawings = * BufentryBase;
	Bufentry = BufentryBase;
	for (ii = 0 ; ii < nbitems; ii++)
	{
		(* Bufentry)->Pnext = * (Bufentry+1);
		Bufentry++;
	}

	MyFree(BufentryBase);
}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:36,代码来源:eelibs1.cpp


示例8: throw

CDynLimBuf &CDynLimBuf::operator+=(const char *s) throw()
{
  if (_error)
    return *this;
  unsigned len = MyStringLen(s);
  size_t rem = _sizeLimit - _pos;
  if (rem < len)
  {
    len = (unsigned)rem;
    _error = true;
  }
  if (_size - _pos < len)
  {
    size_t n = _pos + len;
    if (n - _size < _size)
    {
      n = _sizeLimit;
      if (n - _size > _size)
        n = _size * 2;
    }

    Byte *newBuf = (Byte *)MyAlloc(n);
    if (!newBuf)
    {
      _error = true;
      return *this;
    }
    memcpy(newBuf, _chars, _pos);
    MyFree(_chars);
    _chars = newBuf;
    _size = n;
  }
  memcpy(_chars + _pos, s, len);
  _pos += len;
  return *this;
}
开发者ID:670232921,项目名称:pfm_archive,代码行数:36,代码来源:DynLimBuf.cpp


示例9: UmodeDel

void UmodeDel(Umode *umode)
{
	if (loop.ircd_rehashing)
		umode->unloaded = 1;
	else	
	{
		aClient *cptr;
		for (cptr = client; cptr; cptr = cptr->next)
		{
			long oldumode = 0;
			if (!IsPerson(cptr))
				continue;
			oldumode = cptr->umodes;
			cptr->umodes &= ~umode->mode;
			if (MyClient(cptr))
				send_umode_out(cptr, cptr, oldumode);
		}
		umode->flag = '\0';
		AllUmodes &= ~(umode->mode);
		SendUmodes &= ~(umode->mode);
		make_umodestr();
	}

	if (umode->owner) {
		ModuleObject *umodeobj;
		for (umodeobj = umode->owner->objects; umodeobj; umodeobj = umodeobj->next) {
			if (umodeobj->type == MOBJ_UMODE && umodeobj->object.umode == umode) {
				DelListItem(umodeobj, umode->owner->objects);
				MyFree(umodeobj);
				break;
			}
		}
		umode->owner = NULL;
	}
	return;
}
开发者ID:cyocom,项目名称:Technokats-Website,代码行数:36,代码来源:umodes.c


示例10: Lzma86_Encode

int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
    int level, UInt32 dictSize, int filterMode)
{
  ISzAlloc g_Alloc = { SzAlloc, SzFree };
  size_t outSize2 = *destLen;
  Byte *filteredStream;
  Bool useFilter;
  int mainResult = SZ_ERROR_OUTPUT_EOF;
  CLzmaEncProps props;
  LzmaEncProps_Init(&props);
  props.level = level;
  props.dictSize = dictSize;

  *destLen = 0;
  if (outSize2 < LZMA86_HEADER_SIZE)
    return SZ_ERROR_OUTPUT_EOF;

  {
    int i;
    UInt64 t = srcLen;
    for (i = 0; i < 8; i++, t >>= 8)
      dest[LZMA86_SIZE_OFFSET + i] = (Byte)t;
  }

  filteredStream = 0;
  useFilter = (filterMode != SZ_FILTER_NO);
  if (useFilter)
  {
    if (srcLen != 0)
    {
      filteredStream = (Byte *)MyAlloc(srcLen);
      if (filteredStream == 0)
        return SZ_ERROR_MEM;
      memcpy(filteredStream, src, srcLen);
    }
    {
      UInt32 x86State;
      x86_Convert_Init(x86State);
      x86_Convert(filteredStream, srcLen, 0, &x86State, 1);
    }
  }

  {
    size_t minSize = 0;
    Bool bestIsFiltered = False;

    /* passes for SZ_FILTER_AUTO:
        0 - BCJ + LZMA
        1 - LZMA
        2 - BCJ + LZMA agaian, if pass 0 (BCJ + LZMA) is better.
    */
    int numPasses = (filterMode == SZ_FILTER_AUTO) ? 3 : 1;

    int i;
    for (i = 0; i < numPasses; i++)
    {
      size_t outSizeProcessed = outSize2 - LZMA86_HEADER_SIZE;
      size_t outPropsSize = 5;
      SRes curRes;
      Bool curModeIsFiltered = (numPasses > 1 && i == numPasses - 1);
      if (curModeIsFiltered && !bestIsFiltered)
        break;
      if (useFilter && i == 0)
        curModeIsFiltered = True;

      curRes = LzmaEncode(dest + LZMA86_HEADER_SIZE, &outSizeProcessed,
          curModeIsFiltered ? filteredStream : src, srcLen,
          &props, dest + 1, &outPropsSize, 0,
          NULL, &g_Alloc, &g_Alloc);

      if (curRes != SZ_ERROR_OUTPUT_EOF)
      {
        if (curRes != SZ_OK)
        {
          mainResult = curRes;
          break;
        }
        if (outSizeProcessed <= minSize || mainResult != SZ_OK)
        {
          minSize = outSizeProcessed;
          bestIsFiltered = curModeIsFiltered;
          mainResult = SZ_OK;
        }
      }
    }
    dest[0] = (Byte)(bestIsFiltered ? 1 : 0);
    *destLen = LZMA86_HEADER_SIZE + minSize;
  }
  if (useFilter)
    MyFree(filteredStream);
  return mainResult;
}
开发者ID:borneq,项目名称:bind7z,代码行数:92,代码来源:Lzma86Enc.c


示例11: CMD_FUNC


//.........这里部分代码省略.........
		 */
		sptr->nospoof = getrandom32();

		if (PINGPONG_WARNING)
			sendto_one(sptr, ":%s NOTICE %s :*** If you are having problems"
			    " connecting due to ping timeouts, please"
			    " type /quote pong %X or /raw pong %X now.",
			    me.name, nick, sptr->nospoof, sptr->nospoof);

		sendto_one(sptr, "PING :%X", sptr->nospoof);
#endif /* NOSPOOF */
#ifdef CONTACT_EMAIL
		sendto_one(sptr,
		    ":%s NOTICE %s :*** If you need assistance with a"
		    " connection problem, please email " CONTACT_EMAIL
		    " with the name and version of the client you are"
		    " using, and the server you tried to connect to: %s",
		    me.name, nick, me.name);
#endif /* CONTACT_EMAIL */
#ifdef CONTACT_URL
		sendto_one(sptr,
		    ":%s NOTICE %s :*** If you need assistance with"
		    " connecting to this server, %s, please refer to: "
		    CONTACT_URL, me.name, nick, me.name);
#endif /* CONTACT_URL */

		/* Copy password to the passwd field if it's given after NICK
		 * - originally by taz, modified by Wizzu
		 */
		if ((parc > 2) && (strlen(parv[2]) <= PASSWDLEN)
		    && !(sptr->listener->umodes & LISTENER_JAVACLIENT))
		{
			if (sptr->passwd)
				MyFree(sptr->passwd);
			sptr->passwd = MyMalloc(strlen(parv[2]) + 1);
			(void)strcpy(sptr->passwd, parv[2]);
		}
		/* This had to be copied here to avoid problems.. */
		(void)strcpy(sptr->name, nick);
		if (sptr->user && IsNotSpoof(sptr))
		{
			/*
			   ** USER already received, now we have NICK.
			   ** *NOTE* For servers "NICK" *must* precede the
			   ** user message (giving USER before NICK is possible
			   ** only for local client connection!). register_user
			   ** may reject the client and call exit_client for it
			   ** --must test this and exit m_nick too!!!
			 */
#ifndef NOSPOOF
			if (USE_BAN_VERSION && MyConnect(sptr))
				sendto_one(sptr, ":[email protected]%s PRIVMSG %s :\1VERSION\1",
					me.name, nick);
#endif
			sptr->lastnick = TStime();	/* Always local client */
			if (register_user(cptr, sptr, nick,
			    sptr->user->username, NULL, NULL, NULL) == FLUSH_BUFFER)
				return FLUSH_BUFFER;
			strcpy(nick, sptr->name); /* don't ask, but I need this. do not remove! -- Syzop */
			update_watch = 0;
			newusr = 1;
		}
	}
	/*
	 *  Finally set new nick name.
	 */
开发者ID:cyocom,项目名称:Technokats-Website,代码行数:67,代码来源:m_nick.c


示例12: m_challenge

/*
 * m_challenge - generate RSA challenge for wouldbe oper
 * parv[0] = sender prefix
 * parv[1] = operator to challenge for, or +response
 *
 */
static void
m_challenge(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
	char *challenge;
	dlink_node *ptr;
	struct ConfItem *aconf, *oconf;
	if(!(source_p->user) || !source_p->localClient)
		return;

	/* if theyre an oper, reprint oper motd and ignore */
	if(IsOper(source_p))
	{
		sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, parv[0]);
		SendMessageFile(source_p, &ConfigFileEntry.opermotd);
		return;
	}

	if(*parv[1] == '+')
	{
		/* Ignore it if we aren't expecting this... -A1kmm */
		if(!source_p->user->response)
			return;

		if(irccmp(source_p->user->response, ++parv[1]))
		{
			sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), me.name, source_p->name);
			log_foper(source_p, source_p->user->auth_oper);

			if(ConfigFileEntry.failed_oper_notice)
				sendto_realops_flags(UMODE_ALL, L_ALL,
						     "Failed OPER attempt by %s (%[email protected]%s)",
						     source_p->name, source_p->username,
						     source_p->host);
			return;
		}

		if((aconf = find_conf_by_name(source_p->user->auth_oper, CONF_OPERATOR)) == NULL)
		{
			sendto_one(source_p, form_str(ERR_NOOPERHOST), me.name, parv[0]);
			log_foper(source_p, source_p->user->auth_oper);

			if(ConfigFileEntry.failed_oper_notice)
				sendto_realops_flags(UMODE_ALL, L_ALL,
						     "Failed CHALLENGE attempt - host mismatch by %s (%[email protected]%s)",
						     source_p->name, source_p->username,
						     source_p->host);
			return;
		}

		ptr = source_p->localClient->confs.head;
		oconf = ptr->data;
		detach_conf(source_p, oconf);

		if(attach_conf(source_p, aconf) != 0)
		{
			sendto_one(source_p, ":%s NOTICE %s :Can't attach conf!",
				   me.name, source_p->name);
			sendto_realops_flags(UMODE_ALL, L_ALL,
					     "Failed CHALLENGE attempt by %s (%[email protected]%s) can't attach conf!",
					     source_p->name, source_p->username, source_p->host);
			log_foper(source_p, source_p->user->auth_oper);

			attach_conf(source_p, oconf);
			return;
		}

		oper_up(source_p, aconf);

		ilog(L_TRACE, "OPER %s by %s!%[email protected]%s",
		     source_p->user->auth_oper, source_p->name, source_p->username, source_p->host);
		log_oper(source_p, source_p->user->auth_oper);

		MyFree(source_p->user->response);
		MyFree(source_p->user->auth_oper);
		source_p->user->response = NULL;
		source_p->user->auth_oper = NULL;
		return;
	}

	MyFree(source_p->user->response);
	MyFree(source_p->user->auth_oper);
	source_p->user->response = NULL;
	source_p->user->auth_oper = NULL;

	if(!(aconf = find_conf_exact(parv[1], source_p->username, source_p->host,
				     CONF_OPERATOR)) &&
	   !(aconf = find_conf_exact(parv[1], source_p->username,
				     source_p->localClient->sockhost, CONF_OPERATOR)))
	{
		sendto_one(source_p, form_str(ERR_NOOPERHOST), me.name, parv[0]);
		log_foper(source_p, parv[1]);

		if(ConfigFileEntry.failed_oper_notice)
			sendto_realops_flags(UMODE_ALL, L_ALL,
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:101,代码来源:m_challenge.c


示例13: SzFree

static void SzFree(void *, void *address) { MyFree(address); }
开发者ID:JustFFunny,项目名称:WorkSpace,代码行数:1,代码来源:Lzma2Encoder.cpp


示例14: m_challenge

/*
 * m_challenge - generate RSA challenge for wouldbe oper
 * parv[0] = sender prefix
 * parv[1] = operator to challenge for, or +response
 *
 */
static void
m_challenge(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
{
	char *challenge = NULL;
	struct ConfItem *conf = NULL;
	struct AccessItem *aconf = NULL;

	/* if theyre an oper, reprint oper motd and ignore */
	if(IsOper(source_p))
	{
		sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, parv[0]);
		send_message_file(source_p, &ConfigFileEntry.opermotd);
		return;
	}

	if(*parv[1] == '+')
	{
		/* Ignore it if we aren't expecting this... -A1kmm */
		if(source_p->localClient->response == NULL)
			return;

		if(svsnoop)
		{
			sendto_one(source_p,
				   ":%s NOTICE %s :*** This server is in NOOP mode, you cannot /oper",
				   me.name, source_p->name);
			failed_challenge_notice(source_p, source_p->localClient->auth_oper,
						"This server is in NOOP mode");
			log_oper_action(LOG_FAILED_OPER_TYPE, source_p, "%s\n",
					source_p->localClient->auth_oper);
			return;
		}

		if(irccmp(source_p->localClient->response, ++parv[1]))
		{
			sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), me.name, source_p->name);
			failed_challenge_notice(source_p, source_p->localClient->auth_oper,
						"challenge failed");
			return;
		}

		conf = find_exact_name_conf(OPER_TYPE,
					    source_p->localClient->auth_oper,
					    source_p->username, source_p->host);
		if(conf == NULL)
			conf = find_exact_name_conf(OPER_TYPE,
						    source_p->localClient->auth_oper,
						    source_p->username, source_p->realhost);
		if(conf == NULL)
			conf = find_exact_name_conf(OPER_TYPE,
						    source_p->localClient->auth_oper,
						    source_p->username, source_p->sockhost);
		if(conf == NULL)
		{
			sendto_one(source_p, form_str(ERR_NOOPERHOST), me.name, parv[0]);
			log_oper_action(LOG_FAILED_OPER_TYPE, source_p, "%s\n",
					source_p->localClient->auth_oper);
			return;
		}

		if(attach_conf(source_p, conf) != 0)
		{
			sendto_one(source_p, ":%s NOTICE %s :Can't attach conf!",
				   me.name, source_p->name);
			failed_challenge_notice(source_p, conf->name, "can't attach conf!");
			log_oper_action(LOG_FAILED_OPER_TYPE, source_p, "%s\n",
					source_p->localClient->auth_oper);
			return;
		}

		oper_up(source_p);

		ilog(L_TRACE, "OPER %s by %s!%[email protected]%s",
		     source_p->localClient->auth_oper, source_p->name, source_p->username,
		     source_p->realhost);
		log_oper_action(LOG_OPER_TYPE, source_p, "%s\n", source_p->localClient->auth_oper);

		MyFree(source_p->localClient->response);
		MyFree(source_p->localClient->auth_oper);
		source_p->localClient->response = NULL;
		source_p->localClient->auth_oper = NULL;
		return;
	}

	MyFree(source_p->localClient->response);
	MyFree(source_p->localClient->auth_oper);
	source_p->localClient->response = NULL;
	source_p->localClient->auth_oper = NULL;

	if((conf = find_conf_exact(OPER_TYPE, parv[1], source_p->username, source_p->host)) != NULL)
		aconf = map_to_conf(conf);
	else if((conf = find_conf_exact(OPER_TYPE,
					parv[1], source_p->username, source_p->realhost)) != NULL)
		aconf = map_to_conf(conf);
//.........这里部分代码省略.........
开发者ID:diegoagudo,项目名称:redebr-ircd,代码行数:101,代码来源:m_challenge.c


示例15: CheckJuped

int
CheckJuped(char *name)

{
	struct Jupe *tempjupe;
	struct Server *tempserv;
	char sendstr[MAXLINE + 1], **arv;

	for (tempjupe = JupeList; tempjupe; tempjupe = tempjupe->next)
	{
		if (match(tempjupe->name, name))
		{
			if (tempjupe->isnick)
			{
				struct Luser *lptr;

				if (!(lptr = FindClient(name)))
					return 0;

				/* its a nick jupe, not a server jupe */

#ifdef DANCER

				ircsprintf(sendstr,
				           "NICK %s 1 %ld +i juped juped.com %s %lu :%s\r\n",
				           tempjupe->name,
#ifdef NICKSERVICES
				           (long) (lptr->nick_ts - 1),
#else
				           (long) (lptr->since - 1),
#endif /* NICKSERVICES */
				           Me.name, 0xffffffffL, tempjupe->reason ?
				           tempjupe->reason : "Jupitered Nickname");
#else
				/* collide the nickname */
				ircsprintf(sendstr, "NICK %s 1 %ld +i %s %s %s :%s\r\n",
				           tempjupe->name,
#ifdef NICKSERVICES
				           (long) (lptr->nick_ts - 1),
#else
				(long) (lptr->since - 1),
#endif /* NICKSERVICES */
				           JUPED_USERNAME, JUPED_HOSTNAME, Me.name,
				           tempjupe->reason ? tempjupe->reason :
				           "Jupitered Nickname");
#endif /* DANCER */

				toserv("%s", sendstr);

				DeleteClient(lptr);

				SplitBuf(sendstr, &arv);
				AddClient(arv);
				MyFree(arv);

				if (Me.sptr)
					Me.sptr->numoperkills++;
				Network->TotalOperKills++;
#ifdef STATSERVICES

				if (Network->TotalOperKills > Network->OperKillsT)
					Network->OperKillsT = Network->TotalOperKills;
#endif

			}
			else
			{
				toserv("SQUIT %s :Juped: %s (%s)\r\n", name,
				       tempjupe->reason, tempjupe->who);

				tempserv = FindServer(name);
				DeleteServer(tempserv);

			/* If the fake server is introduced before the remote server has quited,
			 * we get "server already exists" and services get SQUIT'ed,
			 * so we'll introduce it in s_squit()
			 */


			}
			return 1;
		}
	}
	return 0;
} /* CheckJuped */
开发者ID:Cloudxtreme,项目名称:hybserv2,代码行数:85,代码来源:jupe.c


示例16: DeleteClient

void
DeleteClient(struct Luser *user)

{
	struct UserChannel *chnext;

#ifdef NICKSERVICES

	struct NickInfo *nptr, *realptr;

#ifdef CHANNELSERVICES

	struct aChannelPtr *fnext;
#endif

#endif /* NICKSERVICES */

	if (user == NULL)
		return;

	SendUmode(OPERUMODE_CAPE,
	          "*** Client exit: %s!%[email protected]%s [%s]",
	          user->nick,
	          user->username,
	          user->hostname,
	          user->server ? user->server->name : "*unknown*");

#ifdef NICKSERVICES

	realptr = FindNick(user->nick);
	nptr = GetMaster(realptr);
	if (nptr && realptr)
	{

		if (LastSeenInfo && (realptr->flags & NS_IDENTIFIED))
		{
			/*
			 * Update last seen [email protected] info
			 */

			if (realptr->lastu)
				MyFree(realptr->lastu);
			if (realptr->lasth)
				MyFree(realptr->lasth);
			realptr->lastu = MyStrdup(user->username);
			realptr->lasth = MyStrdup(user->hostname);
		}

		/*
		 * they're quitting - unmark them as identified
		 */
		realptr->flags &= ~NS_IDENTIFIED;
	}

#ifdef CHANNELSERVICES
	while (user->founder_channels)
	{
		fnext = user->founder_channels->next;
		RemFounder(user, user->founder_channels->cptr);
		user->founder_channels = fnext;
	}
#endif

#endif /* NICKSERVICES */

#ifdef ALLOW_FUCKOVER
	/* check if user was a target of o_fuckover() */
	CheckFuckoverTarget(user, NULL);
#endif

	if (user->server)
		user->server->numusers--;

	while (user->firstchan)
	{
		chnext = user->firstchan->next;
		RemoveFromChannel(user->firstchan->chptr, user);
		user->firstchan = chnext;
	}

	HashDelClient(user, 0);

	/* keep oper count updated */
	if (user->umodes & UMODE_O)
	{
		Network->TotalOperators--;
		if (user->server)
			user->server->numopers--;
	}

#ifndef BLOCK_ALLOCATION
	MyFree(user->nick);
	MyFree(user->username);
	MyFree(user->hostname);
	MyFree(user->realname);
#endif /* BLOCK_ALLOCATION */

	if (user->prev)
		user->prev->next = user->next;
	else
//.........这里部分代码省略.........
开发者ID:Cloudxtreme,项目名称:hybserv2,代码行数:101,代码来源:client.c


示例17: activityBufferFree

/***************************************************************************************************
*FunctionName: activityBufferFree
*Description: 界面内存释放
*Input: 
*Output: 
*Return: 
*Author: xsx
*Date: 2016年12月21日09:03:10
***************************************************************************************************/
static void activityBufferFree(void)
{
	MyFree(S_WaitPageData);
	S_WaitPageData = NULL;
}
开发者ID:xsxkair,项目名称:NCD_YGFXY,代码行数:14,代码来源:WaittingCardPage.c


示例18: switch

/*****************************************************************************
* Routine to save an EESchema file.											 *
* FileSave controls how the file is to be saved - under what name.			 *
* Returns TRUE if the file has been saved.									 *
*****************************************************************************/
bool WinEDA_SchematicFrame::SaveEEFile(BASE_SCREEN *Window, int FileSave)
{
wxString msg;
wxString Name, BakName;
const wxChar **LibNames;
char * layer, *width;
int ii, shape;
bool Failed = FALSE;
EDA_BaseStruct *Phead;
Ki_PageDescr * PlotSheet;
FILE *f;
wxString dirbuf;

	if ( Window == NULL ) Window = ActiveScreen;

	/* If no name exists in the window yet - save as new. */
	if( Window->m_FileName.IsEmpty() ) FileSave = FILE_SAVE_NEW;

	switch (FileSave)
	{
		case FILE_SAVE_AS:
			dirbuf = wxGetCwd() + STRING_DIR_SEP;
			Name = MakeFileName(dirbuf, Window->m_FileName, g_SchExtBuffer);
			/* Rename the old file to a '.bak' one: */
			BakName = Name;
			if ( wxFileExists(Name) )
			{
				ChangeFileNameExt(BakName, wxT(".bak"));
				wxRemoveFile(BakName);	/* delete Old .bak file */
				if( ! wxRenameFile(Name, BakName) )
				{
					DisplayError(this, wxT("Warning: unable to rename old file"), 10);
				}
			}
			break;

		case FILE_SAVE_NEW:
		{
			wxString mask = wxT("*") + g_SchExtBuffer;
			Name = EDA_FileSelector(_("Schematic files:"),
					wxEmptyString,					/* Chemin par defaut */
					Window->m_FileName,				/* nom fichier par defaut, et resultat */
					g_SchExtBuffer,		/* extension par defaut */
					mask,				/* Masque d'affichage */
					this,
					wxSAVE,
					FALSE
					);
			if ( Name.IsEmpty() ) return FALSE;

			Window->m_FileName = Name;
			dirbuf = wxGetCwd() + STRING_DIR_SEP;
			Name = MakeFileName(dirbuf, Name, g_SchExtBuffer);

			break;
		}

		default: break;
	}

	if ((f = wxFopen(Name, wxT("wt"))) == NULL)
	{
		msg = _("Failed to create file ") + Name;
		DisplayError(this, msg);
		return FALSE;
	}

	msg = _("Save file ") + Name;
	Affiche_Message(msg);

	LibNames = GetLibNames();
	BakName.Empty();	// temporary buffer!
	for (ii = 0; LibNames[ii] != NULL; ii++)
	{
		if (ii > 0) BakName += wxT(",");
		BakName += LibNames[ii];
	}
	MyFree( LibNames);

	if (fprintf(f, "%s %s %d\n", EESCHEMA_FILE_STAMP,
		SCHEMATIC_HEAD_STRING, EESCHEMA_VERSION) == EOF ||
		fprintf(f, "LIBS:%s\n", CONV_TO_UTF8(BakName)) == EOF)
	{
		DisplayError(this, _("File write operation failed."));
		fclose(f);
		return FALSE;
	}

	Window->ClrModify();

	SaveLayers(f);
	/* Sauvegarde des dimensions du schema, des textes du cartouche.. */
	
	PlotSheet = Window->m_CurrentSheet;
	fprintf(f,"$Descr %s %d %d\n",CONV_TO_UTF8(PlotSheet->m_Name),
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,代码来源:save_schemas.cpp


示例19: ss_loaddata

int
ss_loaddata()

{
	FILE *fp;
	char line[MAXLINE + 1], **av;
	char *keyword;
	int ac, ret = 1, cnt;

	if ((fp = fopen(StatServDB, "r")) == NULL)
	{
		/* StatServ data file doesn't exist */
		return (-1);
	}

	cnt = 0;
	/* load data into list */
	while (fgets(line, sizeof(line), fp))
	{
		cnt++;
		ac = SplitBuf(line, &av);
		if (!ac)
		{
			/* probably a blank line */
			MyFree(av);
			continue;
		}

		if (av[0][0] == ';')
		{
			MyFree(av);
			continue;
		}

		if (!ircncmp("->", av[0], 2))
		{
			/*
			 * check if there are enough args
			 */
			if (ac < 3)
			{
				fatal(1, "%s:%d Invalid database format (FATAL)",
				      StatServDB,
				      cnt);
				ret = -2;
				MyFree(av);
				continue;
			}

			keyword = av[0] + 2;
			if (!ircncmp(keyword, "USERS", 5))
			{
				if (Network->TotalUsers <= atol(av[1]))
				{
					Network->MaxUsers = atol(av[1]);
					Network->MaxUsers_ts = atol(av[2]);
				}
			}
			else if (!ircncmp(keyword, "OPERS", 5))
			{
				if (Network->TotalOperators <= atol(av[1]))
				{
					Network->MaxOperators = atol(av[1]);
					Network->MaxOperators_ts = atol(av[2]);
				}
			}
			else if (!ircncmp(keyword, "CHANS", 5))
			{
				if (Network->TotalChannels <= atol(av[1]))
				{
					Network->MaxChannels = atol(av[1]);
					Network->MaxChannels_ts = atol(av[2]);
				}
			}
			else if (!ircncmp(keyword, "SERVS", 5))
			{
				if (Network->TotalServers <= atol(av[1]))
				{
					Network->MaxServers = atol(av[1]);
					Network->MaxServers_ts = atol(av[2]);
				}
			}
		}

		MyFree(av);
	} /* while */

	fclose(fp);

	return (ret);
} /* ss_loaddata */
开发者ID:Cloudxtreme,项目名称:hybserv2,代码行数:91,代码来源:statserv.c


示例20: m_scan_unklines

int
m_scan_unklines(struct Client *cptr, struct Client *sptr, int parc, char *parv[], char *varparv[])
{
  char *mask = NULL;
  int list = 1, count = 0, listed_so_far = 0;
  int list_max = 100;
  int i;
  struct unkline_record **ukr, *ukr2;

  if (!HasUmode(sptr,UMODE_SEEKLINES))
    {
      if (SeesOperMessages(sptr))
	sendto_one(sptr,":%s NOTICE %s :You have no 2 umode", me.name, parv[0]);
      else
	sendto_one(sptr, form_str(ERR_NOPRIVILEGES), me.name, parv[0]);
      return 0;
    }

  if (parc < 2)
    {
      if (!IsServer(sptr))
	sendto_one(sptr, form_str(ERR_NEEDMOREPARAMS),
		   me.name, parv[0], "SCAN UNKLINES");
      return 0;
    }

  for (i = 2; i < parc; i++)
    {
      if (!irccmp(parv[i], "no-list"))
	list = 0;
      else if (!irccmp(parv[i], "list"))
	list = 1;
      else if (i < (parc - 1))
	{
	  if (!irccmp(parv[i], "list-max"))
	    {
	      list_max = atoi(parv[++i]);
	    }
	  else if (!irccmp(parv[i], "mask"))
	    {
	      mask = parv[++i];
	    }
	}
    }

  for (ukr = &recorded_unklines; (ukr2 = *ukr); ukr = &ukr2->next)
    {
      if ((ukr2->placed + UNKLINE_CACHE_TIME) < CurrentTime)
	  {
	    *ukr = ukr2->next;
	    MyFree(ukr2->mask);
	    MyFree(ukr2);
	    /* And put stuff back, safety in case we can't loop again */
	    if (!(ukr2 = *ukr))
	      break;
	  }
      else
        {
          if (mask && !match(mask, ukr2->mask))
            continue;
          count++;
          if (list && (list_max > ++listed_so_far))
/*             send_markup(sptr, &me, "SCAN-UNKLINE", */
/*                         "!begin<1>%s!end<1> unklined at !begin<2>!date<%ld>!end<2> (!begin<3>!time<%ld>!end<3>)", */
/*                         ukr2->mask, ukr2->placed, ukr2->placed - CurrentTime); */
            send_markup(sptr, &me, "SCAN-UNKLINE",
                        "%s unklined at %s (%s)",
                        ukr2->mask, smalldate(ukr2->placed), smalltime(ukr2->placed - CurrentTime));
        }
    }

  send_markup(sptr, &me, "UNKLINE-END", "End of unkline list");
/*   send_markup(sptr, &me, "SCAN-SUMMARY", "!begin<1>%d!end<1> matched", count); */
  send_markup(sptr, &me, "SCAN-SUMMARY", "%d matched", count);

  return 0;
}
开发者ID:BackupTheBerlios,项目名称:phoenixfn-svn,代码行数:77,代码来源:m_scan.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ MyGetCurrentThreadID函数代码示例发布时间:2022-05-30
下一篇:
C++ MyClient函数代码示例发布时间: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