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

C++ pcsl_mem_free函数代码示例

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

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



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


示例16: bt_push_accept

javacall_bool bt_push_accept(bt_pushid_t pushid, const char *filter,
        javacall_handle *handle)
{
    bt_push_t *push = (bt_push_t *)pushid;
    bt_client_t *client;
    if (push == NULL) {
        return JAVACALL_FALSE;
    }
    client = (bt_client_t *)pcsl_mem_malloc(sizeof(bt_client_t));
    switch (push->port.protocol) {
        case BT_L2CAP:
            if (javacall_bt_l2cap_accept(push->server,
                    &client->handle, &client->bdaddr,
                    &client->rmtu, &client->tmtu) != JAVACALL_OK) {
                pcsl_mem_free(client);
                return JAVACALL_FALSE;
            }
            break;
        case BT_SPP:
        case BT_GOEP:
            if (javacall_bt_rfcomm_accept(push->server,
                    &client->handle, &client->bdaddr) != JAVACALL_OK) {
                pcsl_mem_free(client);
                return JAVACALL_FALSE;
            }
            break;
        default:
            pcsl_mem_free(client);
            return JAVACALL_FALSE;
    }
    if (bt_push_test_filter(client->bdaddr, filter) == JAVACALL_TRUE) {
        bt_client_t **client_ptr = &push->client;
        while (*client_ptr != NULL) {
            client_ptr = &(*client_ptr)->next;
        }
        *client_ptr = client;
        client->next = NULL;
        *handle = client->handle;
        return JAVACALL_TRUE;
    }
    close_handle(push->port.protocol, client->handle);
    pcsl_mem_free(client);
    return JAVACALL_FALSE;
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:44,代码来源:btPush.c


示例17: result2string

/**
 * Transforms prepared result buffer to jstring object and release memory of 
 * the allocated buffer.
 * It is safe to call this function after detecting out-of-memory error
 * provided that buf is set to _JSR211_RESULT_INITIALIZER_
 */
static void result2string(_JSR211_INTERNAL_RESULT_BUFFER_* buf, jstring str) {
    if (buf->len > 0 && buf->buf != NULL) {
        KNI_NewString(buf->buf, buf->len, str);
        pcsl_mem_free(buf->buf);
    } else {
        KNI_ReleaseHandle(str);
    }
    buf->len = 0;
    buf->buf = NULL;
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:16,代码来源:regstore.c


示例18: midp_suite_read_secure_resource

/**
 * Reads named secure resource of the suite with specified suiteId
 * from secure persistent storage.
 *
 * Note that when porting memory for the in/out parameter
 * returnValue MUST be allocated using pcsl_mem_malloc().
 * The caller is responsible for freeing it.
 *
 * @param suiteId           The suite id used to identify the MIDlet suite
 * @param resourceName      The name of secure resource to read from storage
 * @param returnValue       The in/out parameter that will return the
 *                          value part of the requested secure resource
 *                          (NULL is a valid return value)
 * @param valueSize         The length of the secure resource value
 *
 * @return one of the error codes:
 * <pre>
 *     ALL_OK, OUT_OF_MEMORY, NOT_FOUND,
 *     SUITE_CORRUPTED_ERROR, BAD_PARAMS
 * </pre>
 */
MIDPError
midp_suite_read_secure_resource(SuiteIdType suiteId,
                                const pcsl_string* resourceName,
                                jbyte **returnValue,
                                jint *valueSize) {
    pcsl_string filename = PCSL_STRING_NULL;
    char *pszError = NULL;
    MIDPError errorCode;
    int bytesRead;
    int handle;

    *returnValue = NULL;
    *valueSize = 0;

    errorCode = get_secure_resource_file(suiteId, resourceName, &filename);
    if (errorCode != ALL_OK) {
        pcsl_string_free(&filename);
        return errorCode;
    }

    handle = storage_open(&pszError, &filename, OPEN_READ);
    pcsl_string_free(&filename);
    if (pszError != NULL) {
        storageFreeError(pszError);
        return SUITE_CORRUPTED_ERROR;
    }

    do {
        bytesRead = storageRead(&pszError, handle,
            (char*)valueSize, sizeof (int));
        if (bytesRead != sizeof (int) || *valueSize == 0)
            break;

        *returnValue = (jbyte*)pcsl_mem_malloc(*valueSize * sizeof (jbyte));
        if (*returnValue == NULL) {
            errorCode = OUT_OF_MEMORY;
            break;
        }

        bytesRead = storageRead(&pszError, handle, (char*)(*returnValue),
            *valueSize * sizeof (jbyte));

        if (pszError != NULL || bytesRead != *valueSize) {
            errorCode = SUITE_CORRUPTED_ERROR;
            pcsl_mem_free(*returnValue);
            *returnValue = NULL;
            break;
        }
    } while (0);

    storageClose(&pszError, handle);
    storageFreeError(pszError);

    return errorCode;
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:76,代码来源:suitestore_secure.c


示例19: midp_links_shutdown

/**
 * Shutdowns Links subsystem.
 */
void midp_links_shutdown() {
    if (portals != NULL) {
        int i;
        for (i = 0; i < JVM_MaxIsolates(); i++) {
            portal_free(&portals[i]);       
        }

        pcsl_mem_free(portals);        
        portals = NULL;
    }
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:14,代码来源:midp_link.c


示例20: close_all

static void close_all(bt_push_t *push)
{
    bt_client_t *client = push->client;
    close_handle(push->port.protocol, push->server);
    while (client != NULL) {
        bt_client_t *next = client->next;
        close_handle(push->port.protocol, client->handle);
        pcsl_mem_free(client);
        client = next;
    }
    push->client = NULL;
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:12,代码来源:btPush.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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