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

C++ PL_strfree函数代码示例

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

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



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

示例1: PL_strfree

nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
{
  if (info.fName)
    PL_strfree(info.fName);

  if (info.fDescription)
    PL_strfree(info.fDescription);

  if (info.fMimeTypeArray)
    FreeStringArray(info.fVariantCount, info.fMimeTypeArray);

  if (info.fMimeDescriptionArray)
    FreeStringArray(info.fVariantCount, info.fMimeDescriptionArray);

  if (info.fExtensionArray)
    FreeStringArray(info.fVariantCount, info.fExtensionArray);

  if (info.fFullPath)
    PL_strfree(info.fFullPath);

  if (info.fFileName)
    PL_strfree(info.fFileName);

  if (info.fVersion)
    PR_smprintf_free(info.fVersion);

  ZeroMemory((void *)&info, sizeof(info));

  return NS_OK;
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:30,代码来源:nsPluginsDirWin.cpp


示例2: PL_strfree

nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
{
   if(info.fName != nsnull)
     PL_strfree(info.fName);

   if(info.fFullPath != nsnull)
     PL_strfree(info.fFullPath);

   if(info.fFileName != nsnull)
     PL_strfree(info.fFileName);
 
   if(info.fVersion != nsnull)
     PL_strfree(info.fVersion);
 
   if(info.fDescription != nsnull)
     PL_strfree(info.fDescription);
 
   if(info.fMimeTypeArray != nsnull)
     FreeStringArray(info.fVariantCount, info.fMimeTypeArray);
 
   if(info.fMimeDescriptionArray != nsnull)
     FreeStringArray(info.fVariantCount, info.fMimeDescriptionArray);
 
   if(info.fExtensionArray != nsnull)
     FreeStringArray(info.fVariantCount, info.fExtensionArray);
 
   memset((void *)&info, 0, sizeof(info));
 
   return NS_OK;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:30,代码来源:nsPluginsDirOS2.cpp


示例3: CallURLNotify

nsNPAPIPluginStreamListener::~nsNPAPIPluginStreamListener()
{
  // remove this from the plugin instance's stream list
  nsTArray<nsNPAPIPluginStreamListener*> *streamListeners = mInst->StreamListeners();
  streamListeners->RemoveElement(this);

  // For those cases when NewStream is never called, we still may need
  // to fire a notification callback. Return network error as fallback
  // reason because for other cases, notify should have already been
  // called for other reasons elsewhere.
  CallURLNotify(NPRES_NETWORK_ERR);
  
  // lets get rid of the buffer
  if (mStreamBuffer) {
    PR_Free(mStreamBuffer);
    mStreamBuffer=nullptr;
  }
  
  if (mNotifyURL)
    PL_strfree(mNotifyURL);
  
  if (mResponseHeaderBuf)
    PL_strfree(mResponseHeaderBuf);

  if (mNPStreamWrapper) {
    delete mNPStreamWrapper;
  }
}
开发者ID:screws0ft,项目名称:releases-mozilla-release,代码行数:28,代码来源:nsNPAPIPluginStreamListener.cpp


示例4: NS_ENSURE_ARG_MAX

NS_IMETHODIMP
nsCommandLine::Init(int32_t argc, const char* const* argv, nsIFile* aWorkingDir,
                    uint32_t aState)
{
  NS_ENSURE_ARG_MAX(aState, 2);

  int32_t i;

  mWorkingDir = aWorkingDir;

  // skip argv[0], we don't want it
  for (i = 1; i < argc; ++i) {
    const char* curarg = argv[i];

#ifdef DEBUG_COMMANDLINE
    printf("Testing native arg %i: '%s'\n", i, curarg);
#endif
#if defined(XP_WIN)
    if (*curarg == '/') {
      char* dup = PL_strdup(curarg);
      if (!dup) return NS_ERROR_OUT_OF_MEMORY;

      *dup = '-';
      char* colon = PL_strchr(dup, ':');
      if (colon) {
        *colon = '\0';
        appendArg(dup);
        appendArg(colon+1);
      } else {
        appendArg(dup);
      }
      PL_strfree(dup);
      continue;
    }
#endif
    if (*curarg == '-') {
      if (*(curarg+1) == '-') ++curarg;

      char* dup = PL_strdup(curarg);
      if (!dup) return NS_ERROR_OUT_OF_MEMORY;

      char* eq = PL_strchr(dup, '=');
      if (eq) {
        *eq = '\0';
        appendArg(dup);
        appendArg(eq + 1);
      } else {
        appendArg(dup);
      }
      PL_strfree(dup);
      continue;
    }

    appendArg(curarg);
  }

  mState = aState;

  return NS_OK;
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:60,代码来源:nsCommandLine.cpp


示例5: PL_strfree

nsJVMPluginTagInfo::~nsJVMPluginTagInfo(void)
{
    if (fSimulatedCodebase)
        PL_strfree(fSimulatedCodebase);

    if (fSimulatedCode)
        PL_strfree(fSimulatedCode);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:8,代码来源:nsJVMPluginTagInfo.cpp


示例6: PL_strfree

nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
{
    if (info.fName != nsnull)
        PL_strfree(info.fName);

    if (info.fDescription != nsnull)
        PL_strfree(info.fDescription);

    for (PRUint32 i = 0; i < info.fVariantCount; i++) {
        if (info.fMimeTypeArray[i] != nsnull)
            PL_strfree(info.fMimeTypeArray[i]);

        if (info.fMimeDescriptionArray[i] != nsnull)
            PL_strfree(info.fMimeDescriptionArray[i]);

        if (info.fExtensionArray[i] != nsnull)
            PL_strfree(info.fExtensionArray[i]);
    }

    PR_FREEIF(info.fMimeTypeArray);
    PR_FREEIF(info.fMimeDescriptionArray);
    PR_FREEIF(info.fExtensionArray);

    if (info.fFullPath != nsnull)
        PL_strfree(info.fFullPath);

    if (info.fFileName != nsnull)
        PL_strfree(info.fFileName);

    if (info.fVersion != nsnull)
        PL_strfree(info.fVersion);

    return NS_OK;
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:34,代码来源:nsPluginsDirUnix.cpp


示例7: PL_strfree

SKIndexResult::~SKIndexResult()
{
    if(m_pszSearchString)
        PL_strfree(m_pszSearchString);
    if(m_pTokens)
        delete (IndexTokens*)m_pTokens;
}
开发者ID:developercyrus,项目名称:skmobile,代码行数:7,代码来源:index.cpp


示例8: clearPrefEntry

static void
clearPrefEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
{
    PrefHashEntry *pref = static_cast<PrefHashEntry *>(entry);
    if (pref->flags & PREF_STRING)
    {
        if (pref->defaultPref.stringVal)
            PL_strfree(pref->defaultPref.stringVal);
        if (pref->userPref.stringVal)
            PL_strfree(pref->userPref.stringVal);
    }
    // don't need to free this as it's allocated in memory owned by
    // gPrefNameArena
    pref->key = nsnull;
    memset(entry, 0, table->entrySize);
}
开发者ID:michaelrhanson,项目名称:mozilla-central,代码行数:16,代码来源:prefapi.cpp


示例9: printf

NS_METHOD
LocalSearchDataSource::parseResourceIntoFindTokens(nsIRDFResource *u, findTokenPtr tokens)
{
	const char		*uri = nsnull;
	char			*id, *token, *value, *newstr;
	int			loop;
	nsresult		rv;

	if (NS_FAILED(rv = u->GetValueConst(&uri)))	return(rv);

#ifdef	DEBUG
	printf("Find: %s\n", (const char*) uri);
#endif

	if (!(id = PL_strdup(uri + sizeof(kFindProtocol) - 1)))
		return(NS_ERROR_OUT_OF_MEMORY);

	/* parse ID, build up token list */
	if ((token = nsCRT::strtok(id, "&", &newstr)) != NULL)
	{
		while (token != NULL)
		{
			if ((value = strstr(token, "=")) != NULL)
			{
				*value++ = '\0';
			}
			for (loop=0; tokens[loop].token != NULL; loop++)
			{
				if (!strcmp(token, tokens[loop].token))
				{
				    if (!strcmp(token, "text"))
				    {
            			nsCOMPtr<nsITextToSubURI> textToSubURI = 
            			         do_GetService(kTextToSubURICID, &rv);
            			if (NS_SUCCEEDED(rv) && (textToSubURI))
            			{
            				PRUnichar	*uni = nsnull;
            				if (NS_SUCCEEDED(rv = textToSubURI->UnEscapeAndConvert("UTF-8", value, &uni)) && (uni))
            				{
    					        tokens[loop].value = uni;
    					        Recycle(uni);
    					    }
    					}
				    }
				    else
				    {
				        nsAutoString    valueStr;
				        valueStr.AssignWithConversion(value);
				        tokens[loop].value = valueStr;
    			    }
					break;
				}
			}
			token = nsCRT::strtok(newstr, "&", &newstr);
		}
	}
	PL_strfree(id);
	return(NS_OK);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:59,代码来源:nsLocalSearchService.cpp


示例10: PR_INIT_CLIST

/**
 * returns a string containing all the parameters in the ConfigStore hash set in the 
 * format key1=value1&&key2=value2&& ...
 * The list will be lexically ordered by parameter key values.
 * The string needs to be freed by the caller.
 **/
TPS_PUBLIC const char* ConfigStore::GetOrderedList()
{
    char *outstr = NULL;
    char *new_string = NULL;
    PRCList order_list;
    PR_INIT_CLIST(&order_list);

    PR_Lock(m_lock);
    PL_HashTableEnumerateEntries(m_root->getSet(), &OrderLoop, &order_list);
    PR_Unlock(m_lock);

    PRCList *current = PR_LIST_HEAD(&order_list);
    PRCList *next;

    outstr = (char*) PR_Malloc(128);
    int allocated = 128;
    int needed = 0;
    PR_snprintf(outstr, 128, "");

    while (current != &order_list) {
        OrderedEntry_t *entry = (OrderedEntry_t *) current;
        const char *value = GetConfigAsString(entry->key, "");

        if ((entry != NULL) && (entry->key != NULL)) {
            needed = PL_strlen(outstr) + PL_strlen(entry->key) + PL_strlen(value) + 4;
            if (allocated <= needed) {
                while (allocated <= needed) {
                    allocated = allocated * 2;
                }
                new_string = (char *)PR_Malloc(allocated);
                PR_snprintf(new_string, allocated, "%s", outstr);
                PR_Free(outstr);
                outstr = new_string;
            } 
                
            PL_strcat(outstr, entry->key);
            PL_strcat(outstr, "=");
            PL_strcat(outstr, value);

            // free the memory for the Ordered Entry
            PL_strfree(entry->key);
        }

        next = PR_NEXT_LINK(current);
        PR_REMOVE_AND_INIT_LINK(current);
        if (current != NULL) {
            PR_Free(current);
        }
        current = next;

        if (current != &order_list) PL_strcat(outstr, "&&");
    }
    return outstr;
}
开发者ID:encukou,项目名称:pki,代码行数:60,代码来源:ConfigStore.cpp


示例11: FreeStringArray

static void FreeStringArray(PRUint32 variants, char ** array)
{
  if ((variants == 0) || !array)
    return;

  for (PRUint32 i = 0; i < variants; i++) {
    if (array[i]) {
      PL_strfree(array[i]);
      array[i] = NULL;
    }
  }
  PR_Free(array);
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:13,代码来源:nsPluginsDirWin.cpp


示例12: PL_strfree

/**
 * Destructs processor.
 */
TPS_PUBLIC HttpConnection::~HttpConnection ()
{
    if( m_clientnickname != NULL ) {
        PL_strfree( m_clientnickname );
        m_clientnickname = NULL;
    }
    if( m_Id != NULL ) {
        PL_strfree( m_Id );
        m_Id = NULL;
    }
    if( m_failoverList != NULL ) {
        delete m_failoverList;
        m_failoverList = NULL;
    }
    if( m_headers != NULL ) {
        delete m_headers;
        m_headers = NULL;
    }
    if( m_lock != NULL ) {
        PR_DestroyLock( m_lock );
        m_lock = NULL;
    }
}
开发者ID:encukou,项目名称:pki,代码行数:26,代码来源:HttpConnection.cpp


示例13: FreeStringArray

static void FreeStringArray(PRUint32 variants, char ** array)
{
  if((variants == 0) || (array == nsnull))
    return;

  for(PRUint32 i = 0; i < variants; i++)
  {
    if(array[i] != nsnull)
    {
      PL_strfree(array[i]);
      array[i] = nsnull;
    }
  }
  PR_Free(array);
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:15,代码来源:nsPluginsDirOS2.cpp


示例14: FreeStringArray

static void FreeStringArray(uint32_t variants, char ** array)
{
  if((variants == 0) || (array == nullptr))
    return;

  for(uint32_t i = 0; i < variants; i++)
  {
    if(array[i] != nullptr)
    {
      PL_strfree(array[i]);
      array[i] = nullptr;
    }
  }
  PR_Free(array);
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:15,代码来源:nsPluginsDirOS2.cpp


示例15: _FreeEntry

static PR_CALLBACK void
_FreeEntry(void* pool, PLHashEntry* he, PRUintn flag)
{
    if( he == NULL ) {
        return;
    }

    if (flag == HT_FREE_VALUE) {
        if( he->value != NULL ) {
            PL_strfree( (char*) he->value );
            he->value = NULL;
        }
    } else if (flag == HT_FREE_ENTRY) {
        if( he->key != NULL ) {
            PL_strfree( (char*) he->key );
            he->key = NULL;
        }
        if( he->value != NULL ) {
            PL_strfree( (char*) he->value );
            he->value = NULL;
        }
        PR_DELETE(he);
    }
}
开发者ID:encukou,项目名称:pki,代码行数:24,代码来源:ConfigStore.cpp


示例16: pref_SetValue

static void pref_SetValue(PrefValue* oldValue, PrefValue newValue, PrefType type)
{
    switch (type & PREF_VALUETYPE_MASK)
    {
        case PREF_STRING:
            PR_ASSERT(newValue.stringVal);
            if (oldValue->stringVal)
                PL_strfree(oldValue->stringVal);
            oldValue->stringVal = newValue.stringVal ? PL_strdup(newValue.stringVal) : NULL;
            break;

        default:
            *oldValue = newValue;
    }
    gDirty = true;
}
开发者ID:michaelrhanson,项目名称:mozilla-central,代码行数:16,代码来源:prefapi.cpp


示例17: DisableWritePoisoning

void DisableWritePoisoning() {
  if (sPoisoningState != POISON_ON)
    return;

  sPoisoningState = POISON_OFF;
  PL_strfree(sProfileDirectory);
  sProfileDirectory = nullptr;

  PRLock *Lock;
  {
    DebugFDAutoLock lockedScope;
    delete getDebugFDs();
    Lock = DebugFDAutoLock::getDebugFDsLock();
    DebugFDAutoLock::Clear();
  }
  PR_DestroyLock(Lock);
}
开发者ID:gdestuynder,项目名称:mozilla-central,代码行数:17,代码来源:mozPoisonWriteBase.cpp


示例18: PREF_Cleanup

/* Frees the callback list. */
void PREF_Cleanup()
{
    NS_ASSERTION(!gCallbacksInProgress,
        "PREF_Cleanup was called while gCallbacksInProgress is true!");
    struct CallbackNode* node = gCallbacks;
    struct CallbackNode* next_node;

    while (node)
    {
        next_node = node->next;
        PL_strfree(node->domain);
        free(node);
        node = next_node;
    }
    gCallbacks = NULL;

    PREF_CleanupPrefs();
}
开发者ID:michaelrhanson,项目名称:mozilla-central,代码行数:19,代码来源:prefapi.cpp


示例19: delete

tmQueue::~tmQueue() {

  // empty the vectors
  PRUint32 index = 0;
  PRUint32 size = mTransactions.Size();
  for ( ; index < size ; index++) {
    if (mTransactions[index])
      delete (tmTransaction *)mTransactions[index];
  }

  // don't need to delete the mListeners because 
  // we just insert PRUint32s, no allocation

  mTM = nsnull;
  mID = 0;
  if (mName)
    PL_strfree(mName);
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:18,代码来源:tmQueue.cpp


示例20: baseName

NSAPI_PUBLIC char * baseName (const char *fileName) {
  char *base = NULL;
  char *fname = NULL;
  base = PL_strdup(fileName);
  fname = base;
  int len = PL_strlen(fname);
  char *p = PL_strrchr(base, '/');

#ifdef XP_WIN32
    if (!p) {  // if no forward slashes check for backward slashes
        p = PL_strrchr(base, '\\');
    }
#endif // XP_WIN32

  if (!p) {  // if no slashes
#ifdef XP_WIN32
    char *driveLetter = strchr(base, ':');
    if (driveLetter) {   // specified only the drive letter
        base = NULL;
    }
#endif // XP_WIN32
  } else if (p == base)  { // only one slash
    if (len > 1) { // more chars after '/'
        base = p + 1;
    } else {
        base = NULL;
    }
  } else if (p == (base + (len - 1))) {
      // name is ending with a slash..set base to NULL
      base = NULL;
  } else {
      base = p + 1;
  }

  if (!base) {
     // set the passed name as the base name
     base = fname;
  }

  char *bname = PL_strdup(base);
  PL_strfree(fname);

  return bname;
}
开发者ID:OldsSourcesBackups,项目名称:Heliod-Web-Server,代码行数:44,代码来源:util.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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