Skip to content

Commit

Permalink
Extract PGrnRemoveObject()
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jan 24, 2016
1 parent ec9a522 commit 074ef12
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
17 changes: 17 additions & 0 deletions src/pgrn_groonga.c
Expand Up @@ -6,6 +6,7 @@
bool PGrnIsLZ4Available;

static grn_ctx *ctx = &PGrnContext;
static struct PGrnBuffers *buffers = &PGrnBuffers;

void
PGrnInitializeGroongaInformation(void)
Expand Down Expand Up @@ -182,3 +183,19 @@ PGrnIndexColumnSetSource(grn_obj *indexColumn, grn_obj *source)

GRN_OBJ_FIN(ctx, &sourceIDs);
}

bool
PGrnRemoveObject(const char *name)
{
grn_obj *object = grn_ctx_get(ctx, name, strlen(name));

if (object)
{
grn_obj_remove(ctx, object);
return true;
}
else
{
return false;
}
}
2 changes: 2 additions & 0 deletions src/pgrn_groonga.h
Expand Up @@ -31,3 +31,5 @@ grn_obj *PGrnCreateColumn(grn_obj *table,
grn_obj *type);

void PGrnIndexColumnSetSource(grn_obj *indexColumn, grn_obj *source);

bool PGrnRemoveObject(const char *name);
16 changes: 0 additions & 16 deletions src/pgroonga.c
Expand Up @@ -4035,22 +4035,6 @@ pgroonga_bulkdelete(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(stats);
}

static bool
PGrnRemoveObject(const char *name)
{
grn_obj *object = grn_ctx_get(ctx, name, strlen(name));

if (object)
{
grn_obj_remove(ctx, object);
return true;
}
else
{
return false;
}
}

#ifdef JSONBOID
static bool
PGrnRemoveJSONValueLexiconTable(const char *typeName, unsigned int relationID)
Expand Down

0 comments on commit 074ef12

Please sign in to comment.