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


C++ TSfree函数代码示例

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


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

示例1: delete_config

static void delete_config(config_t* config) {
	TSDebug(PLUGIN_TAG, "Freeing config");
	TSfree(config->allowIps);
	TSfree(config->allowIps6);
	TSfree(config->stats_path);
	TSfree(config);
}
开发者ID:G4m30v3r,项目名称:traffic_control,代码行数:7,代码来源:astats_over_http.c

示例2: free_request_info

static void
free_request_info(RequestInfo *req_info)
{
  TSfree(req_info->effective_url);
  TSHandleMLocRelease(req_info->buf, TS_NULL_MLOC, req_info->http_hdr_loc);
  TSMBufferDestroy(req_info->buf);
  TSfree(req_info);
}
开发者ID:brkishore,项目名称:trafficserver,代码行数:8,代码来源:stale_while_revalidate.c

示例3: TSRemapDeleteInstance

void
TSRemapDeleteInstance(void *ih)
{
  secure_link_info *sli = (secure_link_info *)ih;

  TSfree(sli->secret);
  TSfree(sli);
}
开发者ID:MengWenkui,项目名称:trafficserver,代码行数:8,代码来源:secure-link.c

示例4: handle_hook

/* handle_hook
 * Fires on TS_EVENT_HTTP_READ_REQUEST_HDR events, gets the effectiveUrl
 * finds the host, gets the generation ID, gen_id, for the host
 * and runs TSCacheUrlSet to change the cache key for the read
 */
static int
handle_hook(TSCont *contp, TSEvent event, void *edata)
{
  TSHttpTxn txnp = (TSHttpTxn)edata;
  char *url = NULL, *host = NULL;
  int url_length;
  int gen_id;
  int ok = 1;

  switch (event) {
  case TS_EVENT_HTTP_READ_REQUEST_HDR:
    TSDebug(PLUGIN_NAME, "handling TS_EVENT_HTTP_READ_REQUEST_HDR");

    if (ok) {
      url = TSHttpTxnEffectiveUrlStringGet(txnp, &url_length);
      if (!url) {
        TSError("[%s] could not retrieve request url", PLUGIN_NAME);
        ok = 0;
      }
    }

    if (ok) {
      get_genid_host(&host, url);
      if (!host) {
        TSError("[%s] could not retrieve request host", PLUGIN_NAME);
        ok = 0;
      }
    }

    if (ok) {
      TSDebug(PLUGIN_NAME, "From url (%s) discovered host (%s)", url, host);
      if ((gen_id = get_genid(host)) != 0) {
        if (TSHttpTxnConfigIntSet(txnp, TS_CONFIG_HTTP_CACHE_GENERATION, gen_id) != TS_SUCCESS) {
          TSDebug(PLUGIN_NAME, "Error, unable to modify cache url");
          TSError("[%s] Unable to set cache generation for %s to %d", PLUGIN_NAME, url, gen_id);
          ok = 0;
        }
      }
    }

    /* Clean up */
    if (url) {
      TSfree(url);
    }
    if (host) {
      TSfree(host);
    }
    TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
    break;

  default:
    TSAssert(!"Unexpected event");
    ok = 0;
    break;
  }

  return ok;
}
开发者ID:GarfieldZ,项目名称:trafficserver_Apache,代码行数:63,代码来源:cache_key_genid.c

示例5: free_plugin_state_t

static void
free_plugin_state_t(plugin_state_t *pstate)
{
  if (pstate->invalidate_list)
    free_invalidate_t_list(pstate->invalidate_list);
  if (pstate->config_file)
    TSfree(pstate->config_file);
  if (pstate->log)
    TSTextLogObjectDestroy(pstate->log);
  TSfree(pstate);
}
开发者ID:BillTheBest,项目名称:trafficserver,代码行数:11,代码来源:regex_revalidate.c

示例6: delete_purge_instance

static void
delete_purge_instance(PurgeInstance *purge)
{
  if (purge) {
    TSfree(purge->id);
    TSfree(purge->state_file);
    TSfree(purge->secret);
    TSfree(purge->header);
    TSMutexDestroy(purge->lock);
    TSfree(purge);
  }
}
开发者ID:cnkedao,项目名称:trafficserver,代码行数:12,代码来源:remap_purge.c

示例7: tsib_txn_ctx_destroy

/**
 * Handle transaction context destroy.
 *
 * Handles TS_EVENT_HTTP_TXN_CLOSE (transaction close) close event from the
 * ATS.
 *
 * @param[in,out] ctx Transaction context
 */
static void tsib_txn_ctx_destroy(tsib_txn_ctx *txndata)
{
    if (txndata == NULL) {
        return;
    }

    ib_tx_t *tx = txndata->tx;
    tsib_ssn_ctx *ssndata = txndata->ssn;

    assert(tx != NULL);
    assert(ssndata != NULL);

    txndata->tx = NULL;
    ib_log_debug_tx(tx,
                    "TX DESTROY: conn=>%p tx_count=%zd tx=%p id=%s txn_count=%d",
                    tx->conn, tx->conn->tx_count, tx, tx->id, ssndata->txn_count);
    tx_finish(tx);

    ib_lock_lock(ssndata->mutex);
    ib_tx_destroy(tx);

    txndata->ssn = NULL;

    /* Decrement the txn count on the ssn, and destroy ssn if it's closing.
     * We trust TS not to create more TXNs after signalling SSN close!
     */
    if (ssndata->closing && ssndata->txn_count <= 1) {
        if (ssndata->iconn) {
            tx_list_destroy(ssndata->iconn);
            ib_conn_t *conn = ssndata->iconn;
            ib_engine_t *ib = conn->ib;

            ssndata->iconn = NULL;
            TSDebug("ironbee",
                    "tsib_txn_ctx_destroy: calling ib_state_notify_conn_closed()");
            ib_state_notify_conn_closed(ib, conn);
            TSDebug("ironbee",
                    "CONN DESTROY: conn=%p", conn);
            ib_conn_destroy(conn);
        }
        TSContDataSet(ssndata->contp, NULL);
        TSContDestroy(ssndata->contp);
        ib_lock_unlock(ssndata->mutex);
        ib_lock_destroy_malloc(ssndata->mutex);
        TSfree(ssndata);
    }
    else {
        --(ssndata->txn_count);
        ib_lock_unlock(ssndata->mutex);
    }
    TSfree(txndata);
}
开发者ID:B0SB05,项目名称:ironbee,代码行数:60,代码来源:ts_event.c

示例8: rewrite_cacheurl

static int rewrite_cacheurl(pr_list *prl, TSHttpTxn txnp) {
    int ok = 1;
    char *newurl = 0;
    int retval;

    char *url;
    int url_length;
    int i;
    if (ok) {
        url = TSHttpTxnEffectiveUrlStringGet(txnp, &url_length);
        if (!url) {
            TSError("[%s] couldn't retrieve request url\n",
                    PLUGIN_NAME);
            ok = 0;
        }
    }

    if (ok) {
        i=0;
        while (i < prl->patterncount && prl->pr[i]) {
            retval = regex_substitute(&newurl, url, prl->pr[i]);
            if (retval) {
                /* Successful match/substitution */
                break;
            }
            i++;
        }
        if (newurl) {
            if (log) {
                TSTextLogObjectWrite(log,
                        "Rewriting cache URL for %s to %s", url,
                        newurl);
            }
            TSDebug(PLUGIN_NAME, "Rewriting cache URL for %s to %s\n",
                    url, newurl);
            if (TSCacheUrlSet(txnp, newurl, strlen(newurl))
                    != TS_SUCCESS) {
                TSError("[%s] Unable to modify cache url from "
                        "%s to %s\n", PLUGIN_NAME, url, newurl);
                ok = 0;
            }
        }
    }
    /* Clean up */
    if (url) TSfree(url);
    if (newurl) TSfree(newurl);
    return ok;
}
开发者ID:heitorganzeli,项目名称:trafficserver,代码行数:48,代码来源:cacheurl.c

示例9: ts_lua_destroy_http_ctx

void
ts_lua_destroy_http_ctx(ts_lua_http_ctx* http_ctx)
{
    ts_lua_main_ctx   *main_ctx;

    main_ctx = http_ctx->mctx;

    if (http_ctx->server_request_bufp) {
        TSHandleMLocRelease(http_ctx->server_request_bufp, TS_NULL_MLOC, http_ctx->server_request_hdrp);
    }

    if (http_ctx->server_response_bufp) {
        TSHandleMLocRelease(http_ctx->server_response_bufp, TS_NULL_MLOC, http_ctx->server_response_hdrp);
    }

    if (http_ctx->client_response_bufp) {
        TSHandleMLocRelease(http_ctx->client_response_bufp, TS_NULL_MLOC, http_ctx->client_response_hdrp);
    }

    if (http_ctx->cached_response_bufp) {
        TSHandleMLocRelease(http_ctx->cached_response_bufp, TS_NULL_MLOC, http_ctx->cached_response_hdrp);
    }

    luaL_unref(main_ctx->lua, LUA_REGISTRYINDEX, http_ctx->ref);
    TSfree(http_ctx);
}
开发者ID:ensonz,项目名称:ts-lua,代码行数:26,代码来源:ts_lua_util.c

示例10: TSRemapInit

TSReturnCode
TSRemapInit(TSRemapInterface * api_info, char *errbuf, int errbuf_size)
{
  int ret;

  if (!api_info || api_info->size < sizeof(TSRemapInterface)) {
    strncpy(errbuf, "[TSRemapInit] - Incorrect size of TSRemapInterface structure", errbuf_size - 1);
    return TS_ERROR;
  }

  if (ts_lua_main_ctx_array != NULL)
    return TS_SUCCESS;

  ts_lua_main_ctx_array = TSmalloc(sizeof(ts_lua_main_ctx) * TS_LUA_MAX_STATE_COUNT);
  memset(ts_lua_main_ctx_array, 0, sizeof(ts_lua_main_ctx) * TS_LUA_MAX_STATE_COUNT);

  ret = ts_lua_create_vm(ts_lua_main_ctx_array, TS_LUA_MAX_STATE_COUNT);

  if (ret) {
    ts_lua_destroy_vm(ts_lua_main_ctx_array, TS_LUA_MAX_STATE_COUNT);
    TSfree(ts_lua_main_ctx_array);
    return TS_ERROR;
  }

  return TS_SUCCESS;
}
开发者ID:MengWenkui,项目名称:trafficserver,代码行数:26,代码来源:ts_lua.c

示例11: ts_lua_client_request_get_pristine_url

static int
ts_lua_client_request_get_pristine_url(lua_State *L)
{
    char        *url;
    int         url_len;

    TSMBuffer   bufp;
    TSMLoc      url_loc;

    ts_lua_http_ctx  *http_ctx;

    http_ctx = ts_lua_get_http_ctx(L);

    if (TSHttpTxnPristineUrlGet(http_ctx->txnp, &bufp, &url_loc) != TS_SUCCESS)
        return 0;

    url = TSUrlStringGet(bufp, url_loc, &url_len);

    if (url) {
        lua_pushlstring(L, url, url_len);
        TSfree(url);

    } else {
        lua_pushnil(L);
    }

    TSHandleMLocRelease(bufp, NULL, url_loc);

    return 1;
}
开发者ID:mzycynb,项目名称:ts-lua,代码行数:30,代码来源:ts_lua_client_request.c

示例12: ts_lua_http_get_remap_to_url

static int
ts_lua_http_get_remap_to_url(lua_State *L)
{
  TSMLoc url = TS_NULL_MLOC;
  char *str  = NULL;
  int len;
  ts_lua_http_ctx *http_ctx;

  GET_HTTP_CONTEXT(http_ctx, L);

  if (TSRemapToUrlGet(http_ctx->txnp, &url) != TS_SUCCESS) {
    lua_pushnil(L);
    goto done;
  }

  str = TSUrlStringGet(NULL, url, &len);

  lua_pushlstring(L, str, len >= TS_LUA_MAX_URL_LENGTH ? TS_LUA_MAX_URL_LENGTH - 1 : len);

done:
  if (str != NULL) {
    TSfree(str);
  }

  return 1;
}
开发者ID:davidbz,项目名称:trafficserver,代码行数:26,代码来源:ts_lua_http.c

示例13: jcrusher_data_destroy

static void
jcrusher_data_destroy(JCrusherData * data)
{
  TSDebug("jcrusher", "Start of jcrusher_data_destroy()");
  if (data) {
    if (data->downstream_buffer) {
      TSDebug("jcrusher", "jcrusher_data_destroy - destroying downstream buffer");
      TSIOBufferDestroy(data->downstream_buffer);
    }
    if (data->json_obj) {
      TSDebug("jcrusher", "jcrusher_data_destroy - destroying json object");
      json_object_put(data->json_obj);
      data->json_obj = NULL;
      TSDebug("jcrusher", "jcrusher_data_destroy - destroying json object -> done");
    }
    if (data->json_tok) {
      TSDebug("jcrusher", "jcrusher_data_destroy - destroying json tokener");
      json_tokener_free(data->json_tok);
      data->json_tok = NULL;
      TSDebug("jcrusher", "jcrusher_data_destroy - destroying json tokener -> done");
    }
    TSDebug("jcrusher", "jcrusher_data_destroy - Freeing data");
    TSfree(data);
    TSDebug("jcrusher", "jcrusher_data_destroy - Freeing data -> done");
  }
  TSDebug("jcrusher", "End of jcrusher_data_destroy()");
}
开发者ID:jbfavre,项目名称:ats-jcrusher-plugin,代码行数:27,代码来源:jcrusher-transform.c

示例14: remove_from_queue

void *
remove_from_queue(Queue *q)
{
  void *data = NULL;
  Cell *remove_cell;

  TSMutexLock(q->mutex);
  if (q->nb_elem > 0) {
    remove_cell = q->head;
    TSAssert(remove_cell->magic == MAGIC_ALIVE);

    data = remove_cell->ptr_data;
    q->head = remove_cell->ptr_prev;
    if (q->head == NULL) {
      TSAssert(q->nb_elem == 1);
      q->tail = NULL;
    } else {
      TSAssert(q->head->magic == MAGIC_ALIVE);
      q->head->ptr_next = NULL;
    }

    remove_cell->magic = MAGIC_DEAD;
    TSfree(remove_cell);
    q->nb_elem--;
  }
  TSMutexUnlock(q->mutex);
  return data;
}
开发者ID:BillTheBest,项目名称:trafficserver,代码行数:28,代码来源:thread.c

示例15: ts_lua_remap_get_to_url

static int
ts_lua_remap_get_to_url(lua_State *L)
{
  char output[TS_LUA_MAX_URL_LENGTH];
  char *url;
  int url_len;
  int output_len;

  ts_lua_http_ctx *http_ctx;

  GET_HTTP_CONTEXT(http_ctx, L);

  if (http_ctx->rri != NULL) {
    url = TSUrlStringGet(http_ctx->client_request_bufp, http_ctx->rri->mapToUrl, &url_len);

    output_len = snprintf(output, TS_LUA_MAX_URL_LENGTH, "%.*s", url_len, url);

    if (output_len >= TS_LUA_MAX_URL_LENGTH) {
      lua_pushlstring(L, output, TS_LUA_MAX_URL_LENGTH - 1);
    } else {
      lua_pushlstring(L, output, output_len);
    }

    TSfree(url);
  } else {
    lua_pushnil(L);
  }

  return 1;
}
开发者ID:BillTheBest,项目名称:trafficserver,代码行数:30,代码来源:ts_lua_remap.c


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