[Groonga-commit] groonga/groonga [master] kytea: XXX != NULL -> XXX

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Nov 13 14:08:46 JST 2012


Kouhei Sutou	2012-11-13 14:08:46 +0900 (Tue, 13 Nov 2012)

  New Revision: bf9ca3d91cf050ad781a1c0c94fdd0e506a282db
  https://github.com/groonga/groonga/commit/bf9ca3d91cf050ad781a1c0c94fdd0e506a282db

  Log:
    kytea: XXX != NULL -> XXX

  Modified files:
    plugins/tokenizers/kytea.cpp

  Modified: plugins/tokenizers/kytea.cpp (+8 -9)
===================================================================
--- plugins/tokenizers/kytea.cpp    2012-11-13 14:06:53 +0900 (c953394)
+++ plugins/tokenizers/kytea.cpp    2012-11-13 14:08:46 +0900 (e8b43b3)
@@ -35,8 +35,7 @@ void kytea_init(grn_ctx *ctx);
 void kytea_fin(grn_ctx *ctx);
 
 void kytea_init(grn_ctx *ctx) {
-  if ((kytea_mutex != NULL) || (kytea_config != NULL) ||
-      (kytea_tagger != NULL) || (kytea_util != NULL)) {
+  if (kytea_mutex || kytea_config || kytea_tagger || kytea_util) {
     GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR,
                      "[tokenizer] TokenKytea is already initialized");
     return;
@@ -52,7 +51,7 @@ void kytea_init(grn_ctx *ctx) {
 
   kytea::KyteaConfig * const config = static_cast<kytea::KyteaConfig *>(
       GRN_PLUGIN_MALLOC(ctx, sizeof(kytea::KyteaConfig)));
-  if (config != NULL) try {
+  if (config) try {
     new (config) kytea::KyteaConfig;
     kytea_config = config;
     try {
@@ -80,7 +79,7 @@ void kytea_init(grn_ctx *ctx) {
 
   kytea::Kytea * const tagger = static_cast<kytea::Kytea *>(
       GRN_PLUGIN_MALLOC(ctx, sizeof(kytea::Kytea)));
-  if (tagger != NULL) try {
+  if (tagger) try {
     new (tagger) kytea::Kytea;
     kytea_tagger = tagger;
     try {
@@ -117,19 +116,19 @@ void kytea_init(grn_ctx *ctx) {
 void kytea_fin(grn_ctx *ctx) {
   kytea_util = NULL;
 
-  if (kytea_tagger != NULL) {
+  if (kytea_tagger) {
     kytea_tagger->~Kytea();
     GRN_PLUGIN_FREE(ctx, kytea_tagger);
     kytea_tagger = NULL;
   }
 
-  if (kytea_config != NULL) {
+  if (kytea_config) {
     kytea_config->~KyteaConfig();
     GRN_PLUGIN_FREE(ctx, kytea_config);
     kytea_config = NULL;
   }
 
-  if (kytea_mutex != NULL) {
+  if (kytea_mutex) {
     grn_plugin_mutex_destroy(ctx, kytea_mutex);
     kytea_mutex = NULL;
   }
@@ -165,7 +164,7 @@ void grn_tokenizer_kytea_init(grn_ctx *ctx, grn_tokenizer_kytea *tokenizer) {
 
 void grn_tokenizer_kytea_fin(grn_ctx *ctx, grn_tokenizer_kytea *tokenizer) {
   grn_tokenizer_token_fin(ctx, &tokenizer->token);
-  if (tokenizer->query != NULL) {
+  if (tokenizer->query) {
     grn_tokenizer_query_destroy(ctx, tokenizer->query);
   }
   tokenizer->~grn_tokenizer_kytea();
@@ -302,7 +301,7 @@ grn_obj *grn_kytea_fin(grn_ctx *ctx, int num_args, grn_obj **args,
                        grn_user_data *user_data) {
   grn_tokenizer_kytea * const tokenizer =
       static_cast<grn_tokenizer_kytea *>(user_data->ptr);
-  if (tokenizer != NULL) {
+  if (tokenizer) {
     grn_tokenizer_kytea_fin(ctx, tokenizer);
     GRN_PLUGIN_FREE(ctx, tokenizer);
   }
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index