当前位置: 首页>>代码示例>>C++>>正文


C++ PL_strfree函数代码示例

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


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


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