Re: [Freeipa-devel] [PATCH 0096] Remove unused str_*split*() functions

2012-11-23 Thread Petr Spacek

On 11/22/2012 01:31 PM, Adam Tkac wrote:

On Tue, Nov 20, 2012 at 12:57:13PM +0100, Petr Spacek wrote:

>Hello,
>
>this patch removes never called  str_*split*() functions and related
>ld_split structure.
>
>We can pull it from history when necessary.

Ack


Pushed to master and v2:
014e36dcceaa1c6e6140e68fb884c806764fb2e6

--
Petr^2 Spacek

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH 0096] Remove unused str_*split*() functions

2012-11-23 Thread Petr Spacek

On 11/22/2012 01:31 PM, Adam Tkac wrote:

On Tue, Nov 20, 2012 at 12:57:13PM +0100, Petr Spacek wrote:

>Hello,
>
>this patch removes never called  str_*split*() functions and related
>ld_split structure.
>
>We can pull it from history when necessary.

Ack


Pushed to master and v2:
014e36dcceaa1c6e6140e68fb884c806764fb2e6

--
Petr^2 Spacek

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH 0096] Remove unused str_*split*() functions

2012-11-22 Thread Adam Tkac
On Tue, Nov 20, 2012 at 12:57:13PM +0100, Petr Spacek wrote:
> Hello,
> 
> this patch removes never called  str_*split*() functions and related
> ld_split structure.
> 
> We can pull it from history when necessary.

Ack

> From dfc3e0009e0b4ba091929d4171e407495f42f72a Mon Sep 17 00:00:00 2001
> From: Petr Spacek 
> Date: Tue, 20 Nov 2012 12:51:38 +0100
> Subject: [PATCH] Remove unused str_*split*() functions and ld_split
>  structure.
> 
> Signed-off-by: Petr Spacek 
> ---
>  src/str.c | 133 
> --
>  src/str.h |   7 
>  2 files changed, 140 deletions(-)
> 
> diff --git a/src/str.c b/src/str.c
> index 
> 83645365ee6eff7bda5fbeda6837f30d4dec41ae..3c5cbbd03a998a539d41ddb51f167eebdc7bdd20
>  100644
> --- a/src/str.c
> +++ b/src/str.c
> @@ -57,14 +57,6 @@ struct ld_string {
>  #endif
>  };
>  
> -struct ld_split {
> - isc_mem_t   *mctx;  /* Memory context.  */
> - char*data;  /* Splits.  */
> - size_t  allocated;  /* Number of bytes allocated.   */
> - char*splits[LD_MAX_SPLITS];
> - size_t  split_count;/* Number of splits.*/
> -};
> -
>  /*
>   * Private functions.
>   */
> @@ -479,128 +471,3 @@ str_casecmp_char(const ld_string_t *s1, const char *s2)
>  
>   return strcasecmp(s1->data, s2);
>  }
> -
> -/*
> - * TODO: Review.
> - */
> -isc_result_t
> -str_new_split(isc_mem_t *mctx, ld_split_t **splitp)
> -{
> - isc_result_t result;
> - ld_split_t *split;
> -
> - REQUIRE(splitp != NULL && *splitp == NULL);
> -
> - CHECKED_MEM_GET_PTR(mctx, split);
> - ZERO_PTR(split);
> - isc_mem_attach(mctx, &split->mctx);
> -
> - *splitp = split;
> - return ISC_R_SUCCESS;
> -
> -cleanup:
> - return result;
> -}
> -
> -void
> -str_destroy_split(ld_split_t **splitp)
> -{
> - ld_split_t *split;
> -
> - if (splitp == NULL || *splitp == NULL)
> -return;
> -
> - split = *splitp;
> -
> - if (split->allocated)
> - isc_mem_free(split->mctx, split->data);
> -
> - isc_mem_putanddetach(&split->mctx, split, sizeof(*split));
> -
> - *splitp = NULL;
> -}
> -
> -static isc_result_t
> -str_split_initialize(ld_split_t *split, const char *str)
> -{
> - size_t size;
> -
> - REQUIRE(split != NULL);
> - REQUIRE(split->mctx != NULL);
> - REQUIRE(str != NULL && *str != '\0');
> -
> - if (split->allocated != 0) {
> - isc_mem_put(split->mctx, split->data, split->allocated);
> - split->allocated = 0;
> - }
> - split->splits[0] = NULL;
> - split->split_count = 0;
> -
> - size = strlen(str) + 1;
> - split->data = isc_mem_strdup(split->mctx, str);
> - if (split->data == NULL)
> - return ISC_R_NOMEMORY;
> -
> - split->allocated = size;
> -
> - return ISC_R_SUCCESS;
> -}
> -
> -isc_result_t
> -str_split(const ld_string_t *src, const char delimiter, ld_split_t *split)
> -{
> - isc_result_t result;
> - unsigned int current_pos;
> - int save;
> -
> - REQUIRE(src != NULL);
> - REQUIRE(delimiter != '\0');
> - REQUIRE(split != NULL);
> -
> - CHECK(str_split_initialize(split, src->data));
> -
> - /* Replace all delimiters with '\0'. */
> - for (unsigned int i = 0; i < split->allocated; i++) {
> - if (split->data[i] == delimiter)
> - split->data[i] = '\0';
> - }
> -
> - /* Now save the right positions. */
> - current_pos = 0;
> - save = 1;
> - for (unsigned int i = 0;
> -  i < split->allocated && current_pos < LD_MAX_SPLITS - 1;
> -  i++) {
> - if (save && split->data[i] != '\0') {
> - split->splits[current_pos] = split->data + i;
> - current_pos++;
> - save = 0;
> - } else if (split->data[i] == '\0') {
> - save = 1;
> - }
> - }
> - split->splits[current_pos] = NULL;
> - split->split_count = current_pos;
> -
> - return ISC_R_SUCCESS;
> -
> -cleanup:
> - return result;
> -}
> -
> -size_t
> -str_split_count(const ld_split_t *split)
> -{
> - REQUIRE(split != NULL);
> -
> - return split->split_count;
> -}
> -
> -const char *
> -str_split_get(const ld_split_t *split, unsigned int split_number)
> -{
> - REQUIRE(split != NULL);
> - REQUIRE(split->split_count >= split_number);
> -
> - return split->splits[split_number];
> -}
> diff --git a/src/str.h b/src/str.h
> index 
> b3dc48fb6156394e5099f6e2d9488093decd8d28..25f6682e78f643eeec02db2e0d0f127c09840691
>  100644
> --- a/src/str.h
> +++ b/src/str.h
> @@ -37,7 +37,6 @@
>  #endif
>  
>  typedef struct ld_string ld_string_t;
> -typedef struct ld_split  ld_split_t;
>  
>  /*
>   * Public functions.
> @@ -65,12 +64,6 @@ void str_to_isc_buffer(const ld_string_t *src, 
> isc_buffer_t *dest);
>