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


C++ PL_HashTableLookup函数代码示例

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


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

示例1: printf

NS_IMETHODIMP nsAppShell::ListenToEventQueue(nsIEventQueue *aQueue,
                                             PRBool aListen)
{
#ifdef DEBUG_APPSHELL
  printf("ListenToEventQueue(%p, %d) this=%p\n", aQueue, aListen, this);
#endif
  if (!sQueueHashTable) {
    sQueueHashTable = PL_NewHashTable(3, (PLHashFunction)IntHashKey,
                                      PL_CompareValues, PL_CompareValues, 0, 0);
  }
  if (!sCountHashTable) {
    sCountHashTable = PL_NewHashTable(3, (PLHashFunction)IntHashKey,
                                      PL_CompareValues, PL_CompareValues, 0, 0);
  }    

  if (aListen) {
    /* add listener */
    PRInt32 key = aQueue->GetEventQueueSelectFD();

    /* only add if we arn't already in the table */
    if (!PL_HashTableLookup(sQueueHashTable, GINT_TO_POINTER(key))) {
      gint tag;
      tag = our_gdk_input_add(aQueue->GetEventQueueSelectFD(),
                              event_processor_callback,
                              aQueue,
                              G_PRIORITY_HIGH_IDLE);
      if (tag >= 0) {
        PL_HashTableAdd(sQueueHashTable, GINT_TO_POINTER(key), GINT_TO_POINTER(tag));
      }
      PLEventQueue *plqueue;
      aQueue->GetPLEventQueue(&plqueue);
      PL_RegisterEventIDFunc(plqueue, getNextRequest, 0);
      sEventQueueList->AppendElement(plqueue);
    }
    /* bump up the count */
    gint count = GPOINTER_TO_INT(PL_HashTableLookup(sCountHashTable, GINT_TO_POINTER(key)));
    PL_HashTableAdd(sCountHashTable, GINT_TO_POINTER(key), GINT_TO_POINTER(count+1));
  } else {
    /* remove listener */
    PRInt32 key = aQueue->GetEventQueueSelectFD();
    
    PLEventQueue *plqueue;
    aQueue->GetPLEventQueue(&plqueue);
    PL_UnregisterEventIDFunc(plqueue);
    sEventQueueList->RemoveElement(plqueue);

    gint count = GPOINTER_TO_INT(PL_HashTableLookup(sCountHashTable, GINT_TO_POINTER(key)));
    if (count - 1 == 0) {
      gint tag = GPOINTER_TO_INT(PL_HashTableLookup(sQueueHashTable, GINT_TO_POINTER(key)));
      if (tag > 0) {
        g_source_remove(tag);
        PL_HashTableRemove(sQueueHashTable, GINT_TO_POINTER(key));
      }
    }
    PL_HashTableAdd(sCountHashTable, GINT_TO_POINTER(key), GINT_TO_POINTER(count-1));

  }

  return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:60,代码来源:nsAppShell.cpp

示例2: NS_ASSERTION

nsresult
nsNodeInfoManager::GetNodeInfo(const nsAString& aName, nsIAtom *aPrefix,
                               PRInt32 aNamespaceID, nsINodeInfo** aNodeInfo)
{
  NS_ASSERTION(!aName.IsEmpty(),
               "Don't pass an empty string to GetNodeInfo, fix caller.");

  nsINodeInfo::nsNodeInfoInner tmpKey(aName, aPrefix, aNamespaceID);

  void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);

  if (node) {
    nsINodeInfo* nodeInfo = static_cast<nsINodeInfo *>(node);

    NS_ADDREF(*aNodeInfo = nodeInfo);

    return NS_OK;
  }

  nsRefPtr<nsNodeInfo> newNodeInfo = nsNodeInfo::Create();
  NS_ENSURE_TRUE(newNodeInfo, nsnull);
  
  nsCOMPtr<nsIAtom> nameAtom = do_GetAtom(aName);
  nsresult rv = newNodeInfo->Init(nameAtom, aPrefix, aNamespaceID, this);
  NS_ENSURE_SUCCESS(rv, rv);

  PLHashEntry *he;
  he = PL_HashTableAdd(mNodeInfoHash, &newNodeInfo->mInner, newNodeInfo);
  NS_ENSURE_TRUE(he, NS_ERROR_FAILURE);

  newNodeInfo.forget(aNodeInfo);

  return NS_OK;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:34,代码来源:nsNodeInfoManager.cpp

示例3: GetBloatEntry

static BloatEntry*
GetBloatEntry(const char* aTypeName, uint32_t aInstanceSize)
{
  if (!gBloatView) {
    RecreateBloatView();
  }
  BloatEntry* entry = NULL;
  if (gBloatView) {
    entry = (BloatEntry*)PL_HashTableLookup(gBloatView, aTypeName);
    if (entry == NULL && aInstanceSize > 0) {

      entry = new BloatEntry(aTypeName, aInstanceSize);
      PLHashEntry* e = PL_HashTableAdd(gBloatView, aTypeName, entry);
      if (e == NULL) {
        delete entry;
        entry = NULL;
      }
    } else {
      NS_ASSERTION(aInstanceSize == 0 ||
                   entry->GetClassSize() == aInstanceSize,
                   "bad size recorded");
    }
  }
  return entry;
}
开发者ID:Tripleman,项目名称:mozilla-central,代码行数:25,代码来源:nsTraceRefcntImpl.cpp

示例4: manifesto_xpi_fn

/*
 *  m a n i f e s t o _ x p i _ f n
 *
 *  Called by pointer from SignArchive(), once for
 *  each file within the directory. This function
 *  is only used for adding to XPI compatible archive
 *
 */
static int
manifesto_xpi_fn(char *relpath, char *basedir, char *reldir, char *filename, void *arg)
{
    char fullname[FNSIZE];
    int count;

    if (verbosity >= 0) {
        PR_fprintf(outputFD, "--> %s\n", relpath);
    }

    /* extension matching */
    if (extensionsGiven) {
        char *ext = PL_strrchr(relpath, '.');
        if (!ext)
            return 0;
        if (!PL_HashTableLookup(extensions, ext))
            return 0;
    }
    count = snprintf(fullname, sizeof(fullname), "%s/%s", basedir, relpath);
    if (count >= sizeof(fullname)) {
        return 1;
    }
    JzipAdd(fullname, relpath, zipfile, compression_level);

    return 0;
}
开发者ID:ojdkbuild,项目名称:lookaside_nss,代码行数:34,代码来源:sign.c

示例5: PR_IMPLEMENT

PR_IMPLEMENT(nsresult) NS_TimelineMarkTimer(const char *timerName, const char *str)
{
    PR_CallOnce(&initonce, TimelineInit);

    if (gTimelineDisabled)
        return NS_ERROR_NOT_AVAILABLE;

    TimelineThreadData *thread = GetThisThreadData();
    if (thread->timers == NULL)
        return NS_ERROR_FAILURE;
    if (thread->disabled)
        return NS_ERROR_NOT_AVAILABLE;
    nsTimelineServiceTimer *timer
        = (nsTimelineServiceTimer *)PL_HashTableLookup(thread->timers, timerName);
    if (timer == NULL) {
        return NS_ERROR_FAILURE;
    }
    PRTime accum = timer->getAccum();

    char buf[500];
    PRInt32 sec, msec;
    ParseTime(accum, sec, msec);
    if (!str)
        PR_snprintf(buf, sizeof buf, "%s total: %d.%03d",
                    timerName, sec, msec);
    else
        PR_snprintf(buf, sizeof buf, "%s total: %d.%03d (%s)",
                    timerName, sec, msec, str);
    NS_TimelineMark(buf);

    return NS_OK;
}
开发者ID:jeppeter,项目名称:vbox,代码行数:32,代码来源:nsTimelineService.cpp

示例6: NS_ENSURE_TRUE

already_AddRefed<nsINodeInfo>
nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
                               PRInt32 aNamespaceID)
{
  NS_ENSURE_TRUE(aName, nsnull);
  NS_ASSERTION(!aName->Equals(EmptyString()),
               "Don't pass an empty string to GetNodeInfo, fix caller.");

  nsINodeInfo::nsNodeInfoInner tmpKey(aName, aPrefix, aNamespaceID);

  void *node = PL_HashTableLookup(mNodeInfoHash, &tmpKey);

  if (node) {
    nsINodeInfo* nodeInfo = static_cast<nsINodeInfo *>(node);

    NS_ADDREF(nodeInfo);

    return nodeInfo;
  }

  nsRefPtr<nsNodeInfo> newNodeInfo = nsNodeInfo::Create();
  NS_ENSURE_TRUE(newNodeInfo, nsnull);
  
  nsresult rv = newNodeInfo->Init(aName, aPrefix, aNamespaceID, this);
  NS_ENSURE_SUCCESS(rv, nsnull);

  PLHashEntry *he;
  he = PL_HashTableAdd(mNodeInfoHash, &newNodeInfo->mInner, newNodeInfo);
  NS_ENSURE_TRUE(he, nsnull);

  nsNodeInfo *nodeInfo = nsnull;
  newNodeInfo.swap(nodeInfo);

  return nodeInfo;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:35,代码来源:nsNodeInfoManager.cpp

示例7: PR_ASSERT

NS_IMETHODIMP
nsTopProgressManager::OnStopBinding(const URL_Struct* url,
                                    PRInt32 status,
                                    const char* message)
{
    PR_ASSERT(url);
    if (! url)
        return NS_ERROR_NULL_POINTER;

    TRACE_PROGRESS(("OnStatus(%s, %d, %s)\n", url->address, status, message));

    PR_ASSERT(fURLs);
    if (! fURLs)
        return NS_ERROR_NULL_POINTER;

    nsTransfer* transfer = (nsTransfer*) PL_HashTableLookup(fURLs, url);

    PR_ASSERT(transfer);
    if (!transfer)
        return NS_ERROR_NULL_POINTER;

    transfer->MarkComplete(status);
    transfer->SetStatus(message);

    return NS_OK;
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:26,代码来源:nsTopProgressManager.cpp

示例8: GetQueueMap

void
tmTransactionService::OnDetachReply(tmTransaction *aTrans) {

  tm_queue_mapping *qmap = GetQueueMap(aTrans->GetQueueID());

  // get the observer before we release the hashtable entry
  ipcITransactionObserver *observer = 
    (ipcITransactionObserver *)PL_HashTableLookup(mObservers, 
                                                 qmap->joinedQueueName);

  // if it was removed, clean up
  if (aTrans->GetStatus() >= 0) {

    // remove the link between observer and queue
    PL_HashTableRemove(mObservers, qmap->joinedQueueName);

    // remove the mapping of queue names and id
    mQueueMaps.Remove(qmap);
    delete qmap;
  }


  // notify the observer -- could be didn't detach
  if (observer)
    observer->OnDetachReply(aTrans->GetQueueID(), aTrans->GetStatus());
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:26,代码来源:tmTransactionService.cpp

示例9: PL_HashTableLookup

void *thread_main(void *arg )
{
    /* BUG!  If the following line is uncommented, a race is NOT detected */
    PL_HashTableLookup(g_hash, "");
    g_cache_misses ++;
    return 0;
}
开发者ID:cogumbreiro,项目名称:locksmith,代码行数:7,代码来源:knot-race-example.c

示例10: replica_updatedn_list_delete

/* if vs is given, delete only those values - otherwise, delete all values */
void
replica_updatedn_list_delete(ReplicaUpdateDNList list, const Slapi_ValueSet *vs)
{
	PLHashTable *hash = list;
	if (!vs || slapi_valueset_count(vs) == 0) { /* just delete everything */
		PL_HashTableEnumerateEntries(hash, replica_destroy_hash_entry, NULL);
	} else {
		Slapi_ValueSet *vs_nc = (Slapi_ValueSet *)vs; /* cast away const */
		Slapi_Value *val = NULL;
		int index = 0;
		for (index = slapi_valueset_first_value(vs_nc, &val); val;
			 index = slapi_valueset_next_value(vs_nc, index, &val)) {
			Slapi_DN *dn = slapi_sdn_new_dn_byval(slapi_value_get_string(val));
			/* locate object */
			Slapi_DN *deldn = (Slapi_DN *)PL_HashTableLookup(hash, slapi_sdn_get_ndn(dn));     
			if (deldn == NULL)
			{
				slapi_log_err(SLAPI_LOG_REPL, repl_plugin_name, "replica_updatedn_list_delete -"
								"Update DN with value (%s) is not in the update DN list.\n",
								slapi_sdn_get_ndn(dn));
			} else {
				/* remove from hash */
				PL_HashTableRemove(hash, slapi_sdn_get_ndn(dn));
				/* free the pointer */
				slapi_sdn_free(&deldn);
			}
			/* free the temp dn */
			slapi_sdn_free(&dn);
		}
	}

	return;
}
开发者ID:Firstyear,项目名称:ds,代码行数:34,代码来源:repl5_updatedn_list.c

示例11: PL_strcmp

void
tmTransactionService::OnAttachReply(tmTransaction *aTrans) {

  // if we attached, store the queue's ID
  if (aTrans->GetStatus() >= 0) {

    PRUint32 size = mQueueMaps.Size();
    tm_queue_mapping *qmap = nsnull;
    for (PRUint32 index = 0; index < size; index++) {
      qmap = (tm_queue_mapping*) mQueueMaps[index];
      if (qmap && 
          PL_strcmp(qmap->joinedQueueName, (char*) aTrans->GetMessage()) == 0) {

        // set the ID in the mapping
        qmap->queueID = aTrans->GetQueueID();
        // send any stored messges to the queue
        DispatchStoredMessages(qmap);
      }
    }
  }

  // notify the observer we have attached (or didn't)
  ipcITransactionObserver *observer = 
    (ipcITransactionObserver *)PL_HashTableLookup(mObservers, 
                                                 (char*)aTrans->GetMessage());
  if (observer)
    observer->OnAttachReply(aTrans->GetQueueID(), aTrans->GetStatus());
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:28,代码来源:tmTransactionService.cpp

示例12: GetJoinedQueueName

void
tmTransactionService::OnFlushReply(tmTransaction *aTrans) {

  ipcITransactionObserver *observer = 
    (ipcITransactionObserver *)PL_HashTableLookup(mObservers, 
                              GetJoinedQueueName(aTrans->GetQueueID()));
  if (observer)
    observer->OnFlushReply(aTrans->GetQueueID(), aTrans->GetStatus());
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:9,代码来源:tmTransactionService.cpp

示例13: PL_HashTableLookup

void
tmTransactionService::OnPost(tmTransaction *aTrans) {

  ipcITransactionObserver *observer = 
    (ipcITransactionObserver*) PL_HashTableLookup(mObservers, 
                              GetJoinedQueueName(aTrans->GetQueueID()));
  if (observer)
    observer->OnTransactionAvailable(aTrans->GetQueueID(), 
                                     aTrans->GetMessage(), 
                                     aTrans->GetMessageLength());
}
开发者ID:EdgarChen,项目名称:mozilla-cvs-history,代码行数:11,代码来源:tmTransactionService.cpp

示例14: SetValue

 SKERR SetValue(const char* pKey, const char* pValue)
 {
     char * pOldValue;
     if((pOldValue = (char*) PL_HashTableLookup(m_pHash, pKey)))
     {
         PL_HashTableRemove(m_pHash, pKey);
     }
     char* pHashKey = PL_strdup(pKey);
     char* pHashValue = PL_strdup(pValue);
     PL_HashTableAdd(m_pHash, pHashKey, pHashValue);
     return noErr;
 }
开发者ID:developercyrus,项目名称:skmobile,代码行数:12,代码来源:envir.cpp

示例15: ImportValue

    SKERR ImportValue(const char *pszKey, const char *pszSystemKey,
                      PRBool bForce)
    {
        char *pszValue;
        if(!bForce)
        {
            pszValue = (char *)PL_HashTableLookup(m_pHash, pszKey);
            if(pszValue)
                return noErr;
        }

        return LoadEnvirFromIni(pszSystemKey);
    }
开发者ID:developercyrus,项目名称:skmobile,代码行数:13,代码来源:envir.cpp


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