本文整理汇总了C++中AFREE函数的典型用法代码示例。如果您正苦于以下问题:C++ AFREE函数的具体用法?C++ AFREE怎么用?C++ AFREE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AFREE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: propertyFile_getInt
int
propertyFile_getInt(const FileData* data, const char* key, int _default,
SearchResult* searchResult) {
char* prop = propertyFile_getValue((const char*)data->data,
data->size,
key);
if (!prop) {
if (searchResult) {
*searchResult = RESULT_NOT_FOUND;
}
return _default;
}
char* end;
// long is only 32 bits on windows so it isn't enough to detect int overflow
long long val = strtoll(prop, &end, 10);
if (val < INT_MIN || val > INT_MAX ||
end == prop || *end != '\0') {
D("Invalid int property: '%s:%s'", key, prop);
AFREE(prop);
if (searchResult) {
*searchResult = RESULT_INVALID;
}
return _default;
}
AFREE(prop);
if (searchResult) {
*searchResult = RESULT_FOUND;
}
return (int)val;
}
示例2: snapshot_info_free
static void
snapshot_info_free( SnapshotInfo* info )
{
AFREE(info->id_str);
AFREE(info->name);
AFREE(info);
}
示例3: pipe_free
static void
pipe_free( Pipe* pipe )
{
if (pipe->funcs->close) {
pipe->funcs->close(pipe->opaque);
}
AFREE(pipe->args);
AFREE(pipe);
}
示例4: pipe_free
static void
pipe_free( Pipe* pipe )
{
/* Call close callback */
if (pipe->funcs->close) {
pipe->funcs->close(pipe->opaque);
}
/* Free stuff */
AFREE(pipe->args);
AFREE(pipe);
}
示例5: iniFile_free
void
iniFile_free( IniFile* i )
{
int nn;
for (nn = 0; nn < i->numPairs; nn++) {
AFREE(i->pairs[nn].key);
i->pairs[nn].key = NULL;
i->pairs[nn].value = NULL;
}
AFREE(i->pairs);
AFREE(i);
}
示例6: pipe_load
static Pipe*
pipe_load( PipeDevice* dev, QEMUFile* file, int version_id )
{
Pipe* pipe;
const PipeService* service = NULL;
int state = qemu_get_byte(file);
uint64_t channel;
if (state != 0) {
/* Pipe is associated with a service. */
char* name = qemu_get_string(file);
if (name == NULL)
return NULL;
service = goldfish_pipe_find_type(name);
if (service == NULL) {
D("No QEMU pipe service named '%s'", name);
AFREE(name);
return NULL;
}
}
if (version_id == GOLDFISH_PIPE_SAVE_VERSION_LEGACY) {
channel = qemu_get_be32(file);
} else {
channel = qemu_get_be64(file);
}
pipe = pipe_new(channel, dev);
pipe->wanted = qemu_get_byte(file);
pipe->closed = qemu_get_byte(file);
if (qemu_get_byte(file) != 0) {
pipe->args = qemu_get_string(file);
}
pipe->service = service;
if (service != NULL) {
pipe->funcs = &service->funcs;
}
if (pipe->funcs->load) {
pipe->opaque = pipe->funcs->load(pipe, service ? service->opaque : NULL, pipe->args, file);
if (pipe->opaque == NULL) {
AFREE(pipe);
return NULL;
}
} else {
/* Force-close the pipe on load */
pipe->closed = 1;
}
return pipe;
}
示例7: aintMap_free
void
aintMap_free( AIntMap* map )
{
if (map) {
if (map->keys != map->keys0)
AFREE(map->keys);
if (map->values != map->values0)
AFREE(map->values);
map->size = 0;
map->capacity = 0;
AFREE(map);
}
}
示例8: kf_compile_object
/*
* NAME: kfun->compile_object()
* DESCRIPTION: compile an object
*/
int kf_compile_object(frame *f, int nargs)
{
char file[STRINGSZ];
value *v;
object *obj;
string **strs;
int i;
v = &f->sp[nargs - 1];
if (path_string(file, v->u.string->text, v->u.string->len) == (char *) NULL)
{
return 1;
}
obj = o_find(file, OACC_MODIFY);
if (obj != (object *) NULL) {
if (!(obj->flags & O_MASTER)) {
error("Cannot recompile cloned object");
}
if (O_UPGRADING(obj)) {
error("Object is already being upgraded");
}
if (O_INHERITED(obj)) {
error("Cannot recompile inherited object");
}
}
if (--nargs != 0) {
strs = ALLOCA(string*, nargs);
for (i = nargs, v = f->sp; i > 0; --i) {
*strs++ = (v++)->u.string;
}
if (ec_push((ec_ftn) NULL)) {
AFREE(strs - nargs);
error((char *) NULL);
}
} else {
示例9: _async_socket_connector_free
/* Destroys AsyncSocketConnector instance.
* Param:
* connector - Initialized AsyncSocketConnector instance.
*/
static void
_async_socket_connector_free(AsyncSocketConnector* connector)
{
if (connector != NULL) {
T("ASC %s: Connector is destroying...", _asc_socket_string(connector));
/* Stop all activities. */
if (asyncConnector_stop(connector->connector) == 0) {
/* Connection was in progress. We need to destroy I/O descriptor for
* that connection. */
D("ASC %s: Stopped async connection in progress.",
_asc_socket_string(connector));
loopIo_done(connector->connector_io);
}
/* Free allocated resources. */
if (connector->looper != NULL) {
loopTimer_done(connector->connector_timer);
if (connector->owns_looper) {
looper_free(connector->looper);
}
}
if (connector->fd >= 0) {
socket_close(connector->fd);
}
T("ASC %s: Connector is destroyed", _asc_socket_string(connector));
sock_address_done(&connector->address);
AFREE(connector);
}
}
示例10: qemud_client_disconnect
/* disconnect a client. this automatically frees the QemudClient.
* note that this also removes the client from the global list
* and from its service's list, if any.
*/
static void
qemud_client_disconnect( void* opaque )
{
QemudClient* c = opaque;
/* remove from current list */
qemud_client_remove(c);
/* send a disconnect command to the daemon */
if (c->channel > 0) {
char tmp[128], *p=tmp, *end=p+sizeof(tmp);
p = bufprint(tmp, end, "disconnect:%02x", c->channel);
qemud_serial_send(c->serial, 0, 0, (uint8_t*)tmp, p-tmp);
}
/* call the client close callback */
if (c->clie_close) {
c->clie_close(c->clie_opaque);
c->clie_close = NULL;
}
c->clie_recv = NULL;
/* remove from service list, if any */
if (c->service) {
qemud_service_remove_client(c->service, c);
c->service = NULL;
}
AFREE(c);
}
示例11: _avdInfo_getContentPath
/* Returns the AVD's content path, i.e. the directory that contains
* the AVD's content files (e.g. data partition, cache, sd card, etc...).
*
* We extract this by parsing the root config .ini file, looking for
* a "path" elements.
*/
static int
_avdInfo_getContentPath( AvdInfo* i )
{
char temp[PATH_MAX], *p=temp, *end=p+sizeof(temp);
i->contentPath = iniFile_getString(i->rootIni, ROOT_ABS_PATH_KEY, NULL);
if (i->contentPath == NULL) {
derror("bad config: %s",
"virtual device file lacks a "ROOT_ABS_PATH_KEY" entry");
return -1;
}
if (!path_is_dir(i->contentPath)) {
// If the absolute path doesn't match an actual directory, try
// the relative path if present.
const char* relPath = iniFile_getString(i->rootIni, ROOT_REL_PATH_KEY, NULL);
if (relPath != NULL) {
p = bufprint_config_path(temp, end);
p = bufprint(p, end, PATH_SEP "%s", relPath);
if (p < end && path_is_dir(temp)) {
AFREE(i->contentPath);
i->contentPath = ASTRDUP(temp);
}
}
}
D("virtual device content at %s", i->contentPath);
return 0;
}
示例12: _getSearchPaths
/* Parse a given config.ini file and extract the list of SDK search paths
* from it. Returns the number of valid paths stored in 'searchPaths', or -1
* in case of problem.
*
* Relative search paths in the config.ini will be stored as full pathnames
* relative to 'sdkRootPath'.
*
* 'searchPaths' must be an array of char* pointers of at most 'maxSearchPaths'
* entries.
*/
static int
_getSearchPaths( IniFile* configIni,
const char* sdkRootPath,
int maxSearchPaths,
char** searchPaths )
{
char temp[PATH_MAX], *p = temp, *end= p+sizeof temp;
int nn, count = 0;
for (nn = 0; nn < maxSearchPaths; nn++) {
char* path;
p = bufprint(temp, end, "%s%d", SEARCH_PREFIX, nn+1 );
if (p >= end)
continue;
path = iniFile_getString(configIni, temp, NULL);
if (path != NULL) {
DD(" found image search path: %s", path);
if (!path_is_absolute(path)) {
p = bufprint(temp, end, "%s/%s", sdkRootPath, path);
AFREE(path);
path = ASTRDUP(temp);
}
searchPaths[count++] = path;
}
}
return count;
}
示例13: avdInfo_initHwConfig
int
avdInfo_initHwConfig( AvdInfo* i, AndroidHwConfig* hw )
{
int ret = 0;
androidHwConfig_init(hw, i->apiLevel);
/* First read the config.ini, if any */
if (i->configIni != NULL) {
ret = androidHwConfig_read(hw, i->configIni);
}
/* The skin's hardware.ini can override values */
if (ret == 0 && i->skinHardwareIni != NULL) {
ret = androidHwConfig_read(hw, i->skinHardwareIni);
}
/* Auto-disable keyboard emulation on sapphire platform builds */
if (i->androidOut != NULL) {
char* p = strrchr(i->androidOut, '/');
if (p != NULL && !strcmp(p,"sapphire")) {
hw->hw_keyboard = 0;
}
}
/* Set hw.useext4=yes, if the Ext4 file system is used. */
const char* p = avdInfo_getSystemInitImagePath(i);
if (path_isExt4Image(p)) {
hw->hw_useext4 = 1;
}
AFREE(p);
return ret;
}
示例14: _camera_device_free
/* Uninitializes and frees WndCameraDevice descriptor.
* Note that upon return from this routine memory allocated for the descriptor
* will be freed.
*/
static void
_camera_device_free(WndCameraDevice* cd)
{
if (cd != NULL) {
if (cd->cap_window != NULL) {
/* Disconnect from the driver. */
capDriverDisconnect(cd->cap_window);
if (cd->dc != NULL) {
W("%s: Frames should not be capturing at this point",
__FUNCTION__);
ReleaseDC(cd->cap_window, cd->dc);
cd->dc = NULL;
}
/* Destroy the capturing window. */
DestroyWindow(cd->cap_window);
cd->cap_window = NULL;
}
if (cd->gdi_bitmap != NULL) {
free(cd->gdi_bitmap);
}
if (cd->frame_bitmap != NULL) {
free(cd->frame_bitmap);
}
if (cd->window_name != NULL) {
free(cd->window_name);
}
if (cd->framebuffer != NULL) {
free(cd->framebuffer);
}
AFREE(cd);
} else {
W("%s: No descriptor", __FUNCTION__);
}
}
示例15: skin_keyboard_free
void
skin_keyboard_free( SkinKeyboard* keyboard )
{
if (keyboard) {
AFREE(keyboard);
}
}