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


C++ pcsl_mem_free函数代码示例

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


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

示例1: jsr120_cbs_delete_msg

/**
 * Delete the given CBS message. The memory used by the message will be
 * released to the memory pool.
 *
 * @param message The message that will have its memory freed.
 */
void jsr120_cbs_delete_msg(CbsMessage* msg) {

    if (msg != NULL) {
        pcsl_mem_free(msg->msgBuffer);
        pcsl_mem_free(msg);
    }
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:13,代码来源:jsr120_cbs_pool.c

示例2: invocFree

/**
 * Free all of the memory used by a stored invocation.
 * 
 * @param stored pointer to an StoredInvoc.
 */
static void invocFree(StoredInvoc* invoc) {
    /*
     * An error occurred allocating memory; release all of the unused
     * Strings, free the structure and throw OutOfMemoryError.
     */
    if (invoc != NULL) {
        if (invoc->args != NULL) {
            /* Free the argument array and strings, if any */
            pcsl_string* args = invoc->args;
            int i = invoc->argsLen;
            while (i--) {
                pcsl_string_free(args++);
            }
            pcsl_mem_free(invoc->args);
        }

        if (invoc->data != NULL) {
            pcsl_mem_free(invoc->data);
        }

        pcsl_string_free(&invoc->url);
        pcsl_string_free(&invoc->type);
        pcsl_string_free(&invoc->action);
        pcsl_string_free(&invoc->ID);
        pcsl_string_free(&invoc->classname);
        pcsl_string_free(&invoc->invokingAuthority);
        pcsl_string_free(&invoc->invokingAppName);
        pcsl_string_free(&invoc->invokingClassname);
        pcsl_string_free(&invoc->invokingID);
        pcsl_string_free(&invoc->username);
        pcsl_string_free(&invoc->password);

        pcsl_mem_free(invoc);
    }
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:40,代码来源:invocStore.c

示例3: jsr120_sms_delete_msg

/**
 * Delete the given SMS message. The memory used by the message will be
 * released to the memory pool.
 *
 * @param message The message that will have its memory freed.
 */
void jsr120_sms_delete_msg(SmsMessage* sms) {
    if (sms) {
        pcsl_mem_free(sms->msgAddr);
        pcsl_mem_free(sms->msgBuffer);
        pcsl_mem_free(sms);
    }
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:13,代码来源:jsr120_sms_pool.c

示例4: jsr120_cbs_delete_msg

/**
 * Delete the given CBS message. The memory used by the message will be
 * released to the memory pool.
 *
 * @param message The message that will have its memory freed.
 */
void jsr120_cbs_delete_msg(CbsMessage* message) {

    if (message != NULL) {
        pcsl_mem_free(message->msgBuffer);
        pcsl_mem_free(message);
    }
}
开发者ID:jiangxilong,项目名称:yari,代码行数:13,代码来源:jsr120_cbs_pool.c

示例5: jsr205_mms_delete_msg

/**
 * Delete the given MMS message and release the memory used by the message to
 * the memory pool.
 *
 * @param msg The message that will have its memory freed.
 */
void jsr205_mms_delete_msg(MmsMessage* msg) {

    if (msg != NULL) {
        pcsl_mem_free(msg->fromAddress);
        pcsl_mem_free(msg->appID);
        pcsl_mem_free(msg->replyToAppID);
        pcsl_mem_free(msg->msgBuffer);
        pcsl_mem_free(msg);
    }
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:16,代码来源:jsr205_mms_pool.c

示例6: JPEG_To_RGB_free

void
JPEG_To_RGB_free(void *info)
{
    struct jpeg_decompress_struct *cinfo =
	(struct jpeg_decompress_struct *) info;
    jm_jpeg_destroy_decompress(cinfo);
    pcsl_mem_free(((jmf_src_data*)cinfo->client_data)->jerr);
    pcsl_mem_free(cinfo->client_data);
    pcsl_mem_free(cinfo->src);
    pcsl_mem_free(cinfo);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:11,代码来源:jpegdecoder.c

示例7: bt_push_shutdown

void bt_push_shutdown()
{
    bt_push_t *push = g_registry;
    REPORT_INFO(LC_PUSH, "Shutting down Bluetooth PushRegistry.");
    while (push != NULL) {
        bt_push_t *next = push->next;
        javacall_bt_sddb_remove_record(push->record.id);
        pcsl_mem_free(push->record.data);
        close_all(push);
        pcsl_mem_free(push);
        push = next;
    }
    g_registry = NULL;
    javacall_bt_sddb_finalize();
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:15,代码来源:btPush.c

示例8: KNIDECL

/**
 * Perform a platform-defined procedure for obtaining random bytes and
 * store the obtained bytes into b, starting from index 0.
 * (see IETF RFC 1750, Randomness Recommendations for Security,
 *  http://www.ietf.org/rfc/rfc1750.txt)
 * @param b array that receives random bytes
 * @param nbytes the number of random bytes to receive, must not be less than size of b
 * @return the number of actually obtained random bytes, -1 in case of an error
 */
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
KNIDECL(com_sun_midp_crypto_PRand_getRandomBytes) {
    jint size;
    jboolean res = KNI_FALSE;
    unsigned char* buffer;

    KNI_StartHandles(1);
    KNI_DeclareHandle(hBytes);
    KNI_GetParameterAsObject(1, hBytes);

    size = KNI_GetParameterAsInt(2);

    buffer = pcsl_mem_malloc(size);
    if (0 == buffer) {
        KNI_ThrowNew(midpOutOfMemoryError, NULL);
    } else {
        int i;
        res = get_random_bytes_port(buffer, size);
        for(i=0; i<size; i++) {
            KNI_SetByteArrayElement(hBytes,i,(jbyte)buffer[i]);
        }
        pcsl_mem_free(buffer);
    }
    
    KNI_EndHandles();
    KNI_ReturnBoolean(res);
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:36,代码来源:prand.c

示例9: remove_event_listener_impl

/**
 * Unregisters the given listener of the specified type.
 *
 * @param fn_callback pointer to the listener function
 * @param listenerType type of events this listener listens for
 *
 * @return error code: ALL_OK if successful,
 *                     NOT_FOUND if the listener was not found
 */
MIDPError
remove_event_listener_impl(void* fn_callback, int listenerType) {
    GenericListener *pListener, *pPrev = NULL;
    int index;

    index = get_listeners_list_index(listenerType);
    if (index < 0) {
        return NOT_FOUND;
    }

    pListener = g_pRegisteredListeners[index];

    while (pListener) {
        if (pListener->fn_callback == fn_callback) {
            if (pPrev) {
                pPrev->pNext = pListener->pNext;
            } else {
                g_pRegisteredListeners[index] = pListener->pNext;
                if (g_pRegisteredListeners[index] == NULL) {
                    remove_listener_type(listenerType);
                }
            }

            pcsl_mem_free(pListener);

            return ALL_OK;
        }

        pPrev = pListener;
        pListener = pListener->pNext;
    }

    return NOT_FOUND;
}
开发者ID:jiangxilong,项目名称:yari,代码行数:43,代码来源:listeners_intern.c

示例10: bt_push_unregister_url

javacall_result bt_push_unregister_url(const char *url)
{
    bt_port_t port;
    bt_push_t *push, *prev;
    REPORT_INFO(LC_PUSH, "Bluetooth PushRegistry URL un-registration:");
    REPORT_INFO1(LC_PUSH, "%s", url);
    bt_push_parse_url(url, &port, NULL);
    push = find_push(&port, &prev);
    if (push == NULL) {
        return JAVACALL_FAIL;
    }
    /* remove the service record */
    javacall_bt_sddb_remove_record(push->record.id);
    /* close server and client connections */
    close_all(push);
    /* remove the entry */
    if (prev != NULL) {
        prev->next = push->next;
    } else {
        g_registry = push->next;
    }
    g_count--;
    pcsl_mem_free(push);
    push_save();
    javacall_bt_stack_set_service_classes(javacall_bt_sddb_get_service_classes(0));
    REPORT_INFO(LC_PUSH, "Un-registration successful.");
    return JAVACALL_OK;
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:28,代码来源:btPush.c

示例11: testAddrToString

/**
 * Test address to string conversion.
 */
void
testAddrToString() {
    unsigned char addr[4];
    unsigned short* result;
    int resultLen;
    int status;
    int i;

    /* test of success */
    addr[0] = 80;
    addr[1] = 80;
    addr[2] = 80;
    addr[3] = 80;

    status = pcsl_network_addrToString(addr, &result, &resultLen);
    assertTrue("gethostbyname failed", PCSL_NET_SUCCESS == status);
    if (PCSL_NET_SUCCESS != status) {
        return;
    }

    printf("Result of addr \"80.80.80.80\" = ");
    for (i = 0; i < resultLen, i++) {
        putchar(result[i]);
    }

    putchar('\n');

    pcsl_mem_free(result);
}
开发者ID:jiangxilong,项目名称:yari,代码行数:32,代码来源:fixmeSimpleNetwork.c

示例12: pcsl_file_finalize

/**
 * Cleans up resources used by file system. It is only needed for the 
 * Ram File System (RMFS).
 * @return 0 on success, -1 otherwise
 */
int pcsl_file_finalize() {
#ifndef PCSL_RAMFS_USE_STATIC
    if (RamfsMemory != NULL) {
        pcsl_mem_free(RamfsMemory);
    }
#endif /* ! PCSL_RAMSF_USE_STATIC */
    return 0;
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:13,代码来源:pcsl_rmfs.c

示例13: free_suite_data_entry

/**
 * Frees the memory occupied by the given MidletSuiteData structure.
 *
 * @param pData MidletSuiteData entry to be freed
 */
void
free_suite_data_entry(MidletSuiteData* pData) {
    if (pData != NULL) {
        if ((pData->jarHashLen > 0) && pData->varSuiteData.pJarHash) {
            pcsl_mem_free(pData->varSuiteData.pJarHash);
        }

        pcsl_string_free(&pData->varSuiteData.midletClassName);
        pcsl_string_free(&pData->varSuiteData.displayName);
        pcsl_string_free(&pData->varSuiteData.iconName);
        pcsl_string_free(&pData->varSuiteData.suiteVendor);
        pcsl_string_free(&pData->varSuiteData.suiteName);
        pcsl_string_free(&pData->varSuiteData.pathToJar);
        pcsl_string_free(&pData->varSuiteData.pathToSettings);

        pcsl_mem_free(pData);
    }
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:23,代码来源:suitestore_intern.c

示例14: read_file

/**
 * Reads the given file into the given buffer.
 * File contents is read as one piece.
 *
 * @param ppszError pointer to character string pointer to accept an error
 * @param pFileName file to read
 * @param outBuffer buffer where the file contents should be stored
 * @param outBufferLen length of the outBuffer
 *
 * @return status code (ALL_OK if there was no errors)
 */
MIDPError
read_file(char** ppszError, const pcsl_string* pFileName,
          char** outBuffer, long* outBufferLen) {
    int handle, status = ALL_OK;
    long fileSize, len;
    char* pszTemp;
    char* buffer = NULL;

    *ppszError  = NULL;
    *outBuffer  = NULL;
    *outBufferLen = 0;

    /* open the file */
    handle = storage_open(ppszError, pFileName, OPEN_READ);
    if (*ppszError != NULL) {
        if (!storage_file_exists(pFileName)) {
            return NOT_FOUND;
        }
        return IO_ERROR;
    }

    do {
        /* get the size of file */
        fileSize = storageSizeOf(ppszError, handle);
        if (*ppszError != NULL) {
            status = IO_ERROR;
            break;
        }

        if (fileSize > 0) {
            /* allocate a buffer to store the file contents */
            buffer = (char*)pcsl_mem_malloc(fileSize);
            if (buffer == NULL) {
                status = OUT_OF_MEMORY;
                break;
            }

            /* read the whole file */
            len = storageRead(ppszError, handle, buffer, fileSize);
            if (*ppszError != NULL || len != fileSize) {
                pcsl_mem_free(buffer);
                status = IO_ERROR;
            }
        }
    } while (0);

    /* close the file */
    storageClose(&pszTemp, handle);
    storageFreeError(pszTemp);

    if (status == ALL_OK) {
        *outBuffer    = buffer;
        *outBufferLen = fileSize;
    }

    return (MIDPError)status;
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:68,代码来源:suitestore_intern.c

示例15: jsr120_list_destroy

/**
 * Deconstruct the entire list and free all memory.
 *
 * @param head The first element of the list to be deconstructed.
 */
void jsr120_list_destroy(ListElement* head) {

    /* If the list doesn't exist, exit now. */
    if (head == NULL) {
        return;
    }

    /* If the next element exists, recursively destroy. */
    if (head->next) {
        jsr120_list_destroy(head->next);
    }

    /* Release any string ID memory. */
    pcsl_mem_free(head->strid);

    /* Release the memory required by the list element. */
    pcsl_mem_free(head);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:23,代码来源:jsr120_list_element.c


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