ovsdb: Add "comment" feature to transactions and make ovs-vsctl use them.
[cascardo/ovs.git] / ovsdb / execution.c
1 /* Copyright (c) 2009 Nicira Networks
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #include <config.h>
17
18 #include <assert.h>
19 #include <limits.h>
20
21 #include "column.h"
22 #include "condition.h"
23 #include "file.h"
24 #include "json.h"
25 #include "mutation.h"
26 #include "ovsdb-data.h"
27 #include "ovsdb-error.h"
28 #include "ovsdb-parser.h"
29 #include "ovsdb.h"
30 #include "query.h"
31 #include "row.h"
32 #include "table.h"
33 #include "timeval.h"
34 #include "transaction.h"
35
36 struct ovsdb_execution {
37     struct ovsdb *db;
38     struct ovsdb_txn *txn;
39     struct ovsdb_symbol_table *symtab;
40     bool durable;
41
42     /* Triggers. */
43     long long int elapsed_msec;
44     long long int timeout_msec;
45 };
46
47 typedef struct ovsdb_error *ovsdb_operation_executor(struct ovsdb_execution *,
48                                                      struct ovsdb_parser *,
49                                                      struct json *result);
50
51 static ovsdb_operation_executor ovsdb_execute_insert;
52 static ovsdb_operation_executor ovsdb_execute_select;
53 static ovsdb_operation_executor ovsdb_execute_update;
54 static ovsdb_operation_executor ovsdb_execute_mutate;
55 static ovsdb_operation_executor ovsdb_execute_delete;
56 static ovsdb_operation_executor ovsdb_execute_wait;
57 static ovsdb_operation_executor ovsdb_execute_commit;
58 static ovsdb_operation_executor ovsdb_execute_abort;
59 static ovsdb_operation_executor ovsdb_execute_declare;
60 static ovsdb_operation_executor ovsdb_execute_comment;
61
62 static ovsdb_operation_executor *
63 lookup_executor(const char *name)
64 {
65     struct ovsdb_operation {
66         const char *name;
67         ovsdb_operation_executor *executor;
68     };
69
70     static const struct ovsdb_operation operations[] = {
71         { "insert", ovsdb_execute_insert },
72         { "select", ovsdb_execute_select },
73         { "update", ovsdb_execute_update },
74         { "mutate", ovsdb_execute_mutate },
75         { "delete", ovsdb_execute_delete },
76         { "wait", ovsdb_execute_wait },
77         { "commit", ovsdb_execute_commit },
78         { "abort", ovsdb_execute_abort },
79         { "declare", ovsdb_execute_declare },
80         { "comment", ovsdb_execute_comment },
81     };
82
83     size_t i;
84
85     for (i = 0; i < ARRAY_SIZE(operations); i++) {
86         const struct ovsdb_operation *c = &operations[i];
87         if (!strcmp(c->name, name)) {
88             return c->executor;
89         }
90     }
91     return NULL;
92 }
93
94 struct json *
95 ovsdb_execute(struct ovsdb *db, const struct json *params,
96               long long int elapsed_msec, long long int *timeout_msec)
97 {
98     struct ovsdb_execution x;
99     struct ovsdb_error *error;
100     struct json *results;
101     size_t n_operations;
102     size_t i;
103
104     if (params->type != JSON_ARRAY) {
105         struct ovsdb_error *error;
106
107         error = ovsdb_syntax_error(params, NULL, "array expected");
108         results = ovsdb_error_to_json(error);
109         ovsdb_error_destroy(error);
110         return results;
111     }
112
113     x.db = db;
114     x.txn = ovsdb_txn_create(db);
115     x.symtab = ovsdb_symbol_table_create();
116     x.durable = false;
117     x.elapsed_msec = elapsed_msec;
118     x.timeout_msec = LLONG_MAX;
119     results = NULL;
120
121     results = json_array_create_empty();
122     n_operations = params->u.array.n;
123     error = NULL;
124     for (i = 0; i < n_operations; i++) {
125         struct json *operation = params->u.array.elems[i];
126         struct ovsdb_error *parse_error;
127         struct ovsdb_parser parser;
128         struct json *result;
129         const struct json *op;
130
131         /* Parse and execute operation. */
132         ovsdb_parser_init(&parser, operation,
133                           "ovsdb operation %zu of %zu", i + 1, n_operations);
134         op = ovsdb_parser_member(&parser, "op", OP_ID);
135         result = json_object_create();
136         if (op) {
137             const char *op_name = json_string(op);
138             ovsdb_operation_executor *executor = lookup_executor(op_name);
139             if (executor) {
140                 error = executor(&x, &parser, result);
141             } else {
142                 ovsdb_parser_raise_error(&parser, "No operation \"%s\"",
143                                          op_name);
144             }
145         } else {
146             assert(ovsdb_parser_has_error(&parser));
147         }
148
149         /* A parse error overrides any other error.
150          * An error overrides any other result. */
151         parse_error = ovsdb_parser_finish(&parser);
152         if (parse_error) {
153             ovsdb_error_destroy(error);
154             error = parse_error;
155         }
156         if (error) {
157             json_destroy(result);
158             result = ovsdb_error_to_json(error);
159         }
160         if (error && !strcmp(ovsdb_error_get_tag(error), "not supported")
161             && timeout_msec) {
162             ovsdb_txn_abort(x.txn);
163             *timeout_msec = x.timeout_msec;
164             ovsdb_error_destroy(error);
165             json_destroy(results);
166             return NULL;
167         }
168
169         /* Add result to array. */
170         json_array_add(results, result);
171         if (error) {
172             break;
173         }
174     }
175
176     if (!error) {
177         error = ovsdb_txn_commit(x.txn, x.durable);
178         if (error) {
179             json_array_add(results, ovsdb_error_to_json(error));
180         }
181     } else {
182         ovsdb_txn_abort(x.txn);
183     }
184
185     while (json_array(results)->n < n_operations) {
186         json_array_add(results, json_null_create());
187     }
188
189     ovsdb_error_destroy(error);
190     ovsdb_symbol_table_destroy(x.symtab);
191
192     return results;
193 }
194
195 struct ovsdb_error *
196 ovsdb_execute_commit(struct ovsdb_execution *x, struct ovsdb_parser *parser,
197                      struct json *result UNUSED)
198 {
199     const struct json *durable;
200
201     durable = ovsdb_parser_member(parser, "durable", OP_BOOLEAN);
202     if (durable && json_boolean(durable)) {
203         x->durable = true;
204     }
205     return NULL;
206 }
207
208 static struct ovsdb_error *
209 ovsdb_execute_abort(struct ovsdb_execution *x UNUSED,
210                     struct ovsdb_parser *parser UNUSED,
211                     struct json *result UNUSED)
212 {
213     return ovsdb_error("aborted", "aborted by request");
214 }
215
216 static struct ovsdb_table *
217 parse_table(struct ovsdb_execution *x,
218             struct ovsdb_parser *parser, const char *member)
219 {
220     struct ovsdb_table *table;
221     const char *table_name;
222     const struct json *json;
223
224     json = ovsdb_parser_member(parser, member, OP_ID);
225     if (!json) {
226         return NULL;
227     }
228     table_name = json_string(json);
229
230     table = shash_find_data(&x->db->tables, table_name);
231     if (!table) {
232         ovsdb_parser_raise_error(parser, "No table named %s.", table_name);
233     }
234     return table;
235 }
236
237 static WARN_UNUSED_RESULT struct ovsdb_error *
238 parse_row(struct ovsdb_parser *parser, const char *member,
239           const struct ovsdb_table *table,
240           const struct ovsdb_symbol_table *symtab,
241           struct ovsdb_row **rowp, struct ovsdb_column_set *columns)
242 {
243     struct ovsdb_error *error;
244     const struct json *json;
245     struct ovsdb_row *row;
246
247     *rowp = NULL;
248
249     if (!table) {
250         return OVSDB_BUG("null table");
251     }
252     json = ovsdb_parser_member(parser, member, OP_OBJECT);
253     if (!json) {
254         return OVSDB_BUG("null row member");
255     }
256
257     row = ovsdb_row_create(table);
258     error = ovsdb_row_from_json(row, json, symtab, columns);
259     if (error) {
260         ovsdb_row_destroy(row);
261         return error;
262     } else {
263         *rowp = row;
264         return NULL;
265     }
266 }
267
268 struct ovsdb_error *
269 ovsdb_execute_insert(struct ovsdb_execution *x, struct ovsdb_parser *parser,
270                      struct json *result)
271 {
272     struct ovsdb_table *table;
273     struct ovsdb_row *row = NULL;
274     const struct json *uuid_name;
275     struct ovsdb_error *error;
276     struct uuid row_uuid;
277
278     table = parse_table(x, parser, "table");
279     uuid_name = ovsdb_parser_member(parser, "uuid-name", OP_ID | OP_OPTIONAL);
280     error = ovsdb_parser_get_error(parser);
281
282     if (uuid_name) {
283         struct ovsdb_symbol *symbol;
284
285         symbol = ovsdb_symbol_table_get(x->symtab, json_string(uuid_name));
286         if (symbol) {
287             if (symbol->used) {
288                 return ovsdb_syntax_error(uuid_name, "duplicate uuid-name",
289                                           "This \"uuid-name\" appeared on an "
290                                           "earlier \"insert\" operation.");
291             }
292             row_uuid = symbol->uuid;
293             symbol->used = true;
294         } else {
295             uuid_generate(&row_uuid);
296             ovsdb_symbol_table_put(x->symtab, json_string(uuid_name),
297                                    &row_uuid, true);
298         }
299     } else {
300         uuid_generate(&row_uuid);
301     }
302
303     if (!error) {
304         error = parse_row(parser, "row", table, x->symtab, &row, NULL);
305     }
306     if (!error) {
307         *ovsdb_row_get_uuid_rw(row) = row_uuid;
308         ovsdb_txn_row_insert(x->txn, row);
309         json_object_put(result, "uuid",
310                         ovsdb_datum_to_json(&row->fields[OVSDB_COL_UUID],
311                                             &ovsdb_type_uuid));
312         row = NULL;
313     }
314     return error;
315 }
316
317 struct ovsdb_error *
318 ovsdb_execute_select(struct ovsdb_execution *x, struct ovsdb_parser *parser,
319                      struct json *result)
320 {
321     struct ovsdb_table *table;
322     const struct json *where, *columns_json, *sort_json;
323     struct ovsdb_condition condition = OVSDB_CONDITION_INITIALIZER;
324     struct ovsdb_column_set columns = OVSDB_COLUMN_SET_INITIALIZER;
325     struct ovsdb_column_set sort = OVSDB_COLUMN_SET_INITIALIZER;
326     struct ovsdb_error *error;
327
328     table = parse_table(x, parser, "table");
329     where = ovsdb_parser_member(parser, "where", OP_ARRAY);
330     columns_json = ovsdb_parser_member(parser, "columns",
331                                        OP_ARRAY | OP_OPTIONAL);
332     sort_json = ovsdb_parser_member(parser, "sort", OP_ARRAY | OP_OPTIONAL);
333
334     error = ovsdb_parser_get_error(parser);
335     if (!error) {
336         error = ovsdb_condition_from_json(table->schema, where, x->symtab,
337                                           &condition);
338     }
339     if (!error) {
340         error = ovsdb_column_set_from_json(columns_json, table, &columns);
341     }
342     if (!error) {
343         error = ovsdb_column_set_from_json(sort_json, table, &sort);
344     }
345     if (!error) {
346         struct ovsdb_row_set rows = OVSDB_ROW_SET_INITIALIZER;
347
348         ovsdb_query_distinct(table, &condition, &columns, &rows);
349         ovsdb_row_set_sort(&rows, &sort);
350         json_object_put(result, "rows",
351                         ovsdb_row_set_to_json(&rows, &columns));
352
353         ovsdb_row_set_destroy(&rows);
354     }
355
356     ovsdb_column_set_destroy(&columns);
357     ovsdb_column_set_destroy(&sort);
358     ovsdb_condition_destroy(&condition);
359
360     return error;
361 }
362
363 struct update_row_cbdata {
364     size_t n_matches;
365     struct ovsdb_txn *txn;
366     const struct ovsdb_row *row;
367     const struct ovsdb_column_set *columns;
368 };
369
370 static bool
371 update_row_cb(const struct ovsdb_row *row, void *ur_)
372 {
373     struct update_row_cbdata *ur = ur_;
374
375     ur->n_matches++;
376     if (!ovsdb_row_equal_columns(row, ur->row, ur->columns)) {
377         ovsdb_row_update_columns(ovsdb_txn_row_modify(ur->txn, row),
378                                  ur->row, ur->columns);
379     }
380
381     return true;
382 }
383
384 struct ovsdb_error *
385 ovsdb_execute_update(struct ovsdb_execution *x, struct ovsdb_parser *parser,
386                      struct json *result)
387 {
388     struct ovsdb_table *table;
389     const struct json *where;
390     struct ovsdb_condition condition = OVSDB_CONDITION_INITIALIZER;
391     struct ovsdb_column_set columns = OVSDB_COLUMN_SET_INITIALIZER;
392     struct ovsdb_row *row = NULL;
393     struct update_row_cbdata ur;
394     struct ovsdb_error *error;
395
396     table = parse_table(x, parser, "table");
397     where = ovsdb_parser_member(parser, "where", OP_ARRAY);
398     error = ovsdb_parser_get_error(parser);
399     if (!error) {
400         error = parse_row(parser, "row", table, x->symtab, &row, &columns);
401     }
402     if (!error) {
403         error = ovsdb_condition_from_json(table->schema, where, x->symtab,
404                                           &condition);
405     }
406     if (!error) {
407         ur.n_matches = 0;
408         ur.txn = x->txn;
409         ur.row = row;
410         ur.columns = &columns;
411         ovsdb_query(table, &condition, update_row_cb, &ur);
412         json_object_put(result, "count", json_integer_create(ur.n_matches));
413     }
414
415     ovsdb_row_destroy(row);
416     ovsdb_column_set_destroy(&columns);
417     ovsdb_condition_destroy(&condition);
418
419     return error;
420 }
421
422 struct mutate_row_cbdata {
423     size_t n_matches;
424     struct ovsdb_txn *txn;
425     const struct ovsdb_mutation_set *mutations;
426 };
427
428 static bool
429 mutate_row_cb(const struct ovsdb_row *row, void *mr_)
430 {
431     struct mutate_row_cbdata *mr = mr_;
432
433     mr->n_matches++;
434     ovsdb_mutation_set_execute(ovsdb_txn_row_modify(mr->txn, row),
435                                mr->mutations);
436
437     return true;
438 }
439
440 struct ovsdb_error *
441 ovsdb_execute_mutate(struct ovsdb_execution *x, struct ovsdb_parser *parser,
442                      struct json *result)
443 {
444     struct ovsdb_table *table;
445     const struct json *where;
446     const struct json *mutations_json;
447     struct ovsdb_condition condition = OVSDB_CONDITION_INITIALIZER;
448     struct ovsdb_mutation_set mutations = OVSDB_MUTATION_SET_INITIALIZER;
449     struct ovsdb_row *row = NULL;
450     struct mutate_row_cbdata mr;
451     struct ovsdb_error *error;
452
453     table = parse_table(x, parser, "table");
454     where = ovsdb_parser_member(parser, "where", OP_ARRAY);
455     mutations_json = ovsdb_parser_member(parser, "mutations", OP_ARRAY);
456     error = ovsdb_parser_get_error(parser);
457     if (!error) {
458         error = ovsdb_mutation_set_from_json(table->schema, mutations_json,
459                                              x->symtab, &mutations);
460     }
461     if (!error) {
462         error = ovsdb_condition_from_json(table->schema, where, x->symtab,
463                                           &condition);
464     }
465     if (!error) {
466         mr.n_matches = 0;
467         mr.txn = x->txn;
468         mr.mutations = &mutations;
469         ovsdb_query(table, &condition, mutate_row_cb, &mr);
470         json_object_put(result, "count", json_integer_create(mr.n_matches));
471     }
472
473     ovsdb_row_destroy(row);
474     ovsdb_mutation_set_destroy(&mutations);
475     ovsdb_condition_destroy(&condition);
476
477     return error;
478 }
479
480 struct delete_row_cbdata {
481     size_t n_matches;
482     const struct ovsdb_table *table;
483     struct ovsdb_txn *txn;
484 };
485
486 static bool
487 delete_row_cb(const struct ovsdb_row *row, void *dr_)
488 {
489     struct delete_row_cbdata *dr = dr_;
490
491     dr->n_matches++;
492     ovsdb_txn_row_delete(dr->txn, row);
493
494     return true;
495 }
496
497 struct ovsdb_error *
498 ovsdb_execute_delete(struct ovsdb_execution *x, struct ovsdb_parser *parser,
499                      struct json *result)
500 {
501     struct ovsdb_table *table;
502     const struct json *where;
503     struct ovsdb_condition condition = OVSDB_CONDITION_INITIALIZER;
504     struct ovsdb_error *error;
505
506     where = ovsdb_parser_member(parser, "where", OP_ARRAY);
507     table = parse_table(x, parser, "table");
508     error = ovsdb_parser_get_error(parser);
509     if (!error) {
510         error = ovsdb_condition_from_json(table->schema, where, x->symtab,
511                                           &condition);
512     }
513     if (!error) {
514         struct delete_row_cbdata dr;
515
516         dr.n_matches = 0;
517         dr.table = table;
518         dr.txn = x->txn;
519         ovsdb_query(table, &condition, delete_row_cb, &dr);
520
521         json_object_put(result, "count", json_integer_create(dr.n_matches));
522     }
523
524     ovsdb_condition_destroy(&condition);
525
526     return error;
527 }
528
529 struct wait_auxdata {
530     struct ovsdb_row_hash *actual;
531     struct ovsdb_row_hash *expected;
532     bool *equal;
533 };
534
535 static bool
536 ovsdb_execute_wait_query_cb(const struct ovsdb_row *row, void *aux_)
537 {
538     struct wait_auxdata *aux = aux_;
539
540     if (ovsdb_row_hash_contains(aux->expected, row)) {
541         ovsdb_row_hash_insert(aux->actual, row);
542         return true;
543     } else {
544         /* The query row isn't in the expected result set, so the actual and
545          * expected results sets definitely differ and we can short-circuit the
546          * rest of the query. */
547         *aux->equal = false;
548         return false;
549     }
550 }
551
552 static struct ovsdb_error *
553 ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser,
554                    struct json *result UNUSED)
555 {
556     struct ovsdb_table *table;
557     const struct json *timeout, *where, *columns_json, *until, *rows;
558     struct ovsdb_condition condition = OVSDB_CONDITION_INITIALIZER;
559     struct ovsdb_column_set columns = OVSDB_COLUMN_SET_INITIALIZER;
560     struct ovsdb_row_hash expected = OVSDB_ROW_HASH_INITIALIZER(expected);
561     struct ovsdb_row_hash actual = OVSDB_ROW_HASH_INITIALIZER(actual);
562     struct ovsdb_error *error;
563     struct wait_auxdata aux;
564     long long int timeout_msec = 0;
565     size_t i;
566
567     timeout = ovsdb_parser_member(parser, "timeout", OP_NUMBER | OP_OPTIONAL);
568     where = ovsdb_parser_member(parser, "where", OP_ARRAY);
569     columns_json = ovsdb_parser_member(parser, "columns",
570                                        OP_ARRAY | OP_OPTIONAL);
571     until = ovsdb_parser_member(parser, "until", OP_STRING);
572     rows = ovsdb_parser_member(parser, "rows", OP_ARRAY);
573     table = parse_table(x, parser, "table");
574     error = ovsdb_parser_get_error(parser);
575     if (!error) {
576         error = ovsdb_condition_from_json(table->schema, where, x->symtab,
577                                           &condition);
578     }
579     if (!error) {
580         error = ovsdb_column_set_from_json(columns_json, table, &columns);
581     }
582     if (!error) {
583         if (timeout) {
584             timeout_msec = MIN(LLONG_MAX, json_real(timeout));
585             if (timeout_msec < 0) {
586                 error = ovsdb_syntax_error(timeout, NULL,
587                                            "timeout must be nonnegative");
588             } else if (timeout_msec < x->timeout_msec) {
589                 x->timeout_msec = timeout_msec;
590             }
591         } else {
592             timeout_msec = LLONG_MAX;
593         }
594         if (strcmp(json_string(until), "==")
595             && strcmp(json_string(until), "!=")) {
596             error = ovsdb_syntax_error(until, NULL,
597                                        "\"until\" must be \"==\" or \"!=\"");
598         }
599     }
600     if (!error) {
601         /* Parse "rows" into 'expected'. */
602         ovsdb_row_hash_init(&expected, &columns);
603         for (i = 0; i < rows->u.array.n; i++) {
604             struct ovsdb_error *error;
605             struct ovsdb_row *row;
606
607             row = ovsdb_row_create(table);
608             error = ovsdb_row_from_json(row, rows->u.array.elems[i], x->symtab,
609                                         NULL);
610             if (error) {
611                 break;
612             }
613
614             if (!ovsdb_row_hash_insert(&expected, row)) {
615                 /* XXX Perhaps we should abort with an error or log a
616                  * warning. */
617                 ovsdb_row_destroy(row);
618             }
619         }
620     }
621     if (!error) {
622         /* Execute query. */
623         bool equal = true;
624         ovsdb_row_hash_init(&actual, &columns);
625         aux.actual = &actual;
626         aux.expected = &expected;
627         aux.equal = &equal;
628         ovsdb_query(table, &condition, ovsdb_execute_wait_query_cb, &aux);
629         if (equal) {
630             /* We know that every row in 'actual' is also in 'expected'.  We
631              * also know that all of the rows in 'actual' are distinct and that
632              * all of the rows in 'expected' are distinct.  Therefore, if
633              * 'actual' and 'expected' have the same number of rows, then they
634              * have the same content. */
635             size_t n_actual = ovsdb_row_hash_count(&actual);
636             size_t n_expected = ovsdb_row_hash_count(&expected);
637             equal = n_actual == n_expected;
638         }
639         if (!strcmp(json_string(until), "==") != equal) {
640             if (timeout && x->elapsed_msec >= timeout_msec) {
641                 if (x->elapsed_msec) {
642                     error = ovsdb_error("timed out",
643                                         "\"wait\" timed out after %lld ms",
644                                         x->elapsed_msec);
645                 } else {
646                     error = ovsdb_error("timed out", "\"wait\" timed out");
647                 }
648             } else {
649                 /* ovsdb_execute() will change this, if triggers really are
650                  * supported. */
651                 error = ovsdb_error("not supported", "triggers not supported");
652             }
653         }
654     }
655
656
657     ovsdb_row_hash_destroy(&expected, true);
658     ovsdb_row_hash_destroy(&actual, false);
659     ovsdb_column_set_destroy(&columns);
660     ovsdb_condition_destroy(&condition);
661
662     return error;
663 }
664
665 static struct ovsdb_error *
666 ovsdb_execute_declare(struct ovsdb_execution *x, struct ovsdb_parser *parser,
667                       struct json *result)
668 {
669     const struct json *uuid_name;
670     struct uuid uuid;
671
672     uuid_name = ovsdb_parser_member(parser, "uuid-name", OP_ID);
673     if (!uuid_name) {
674         return NULL;
675     }
676
677     if (ovsdb_symbol_table_get(x->symtab, json_string(uuid_name))) {
678         return ovsdb_syntax_error(uuid_name, "duplicate uuid-name",
679                                   "This \"uuid-name\" appeared on an "
680                                   "earlier \"declare\" or \"insert\" "
681                                   "operation.");
682     }
683
684     uuid_generate(&uuid);
685     ovsdb_symbol_table_put(x->symtab, json_string(uuid_name), &uuid, false);
686     json_object_put(result, "uuid", json_string_create_nocopy(
687                         xasprintf(UUID_FMT, UUID_ARGS(&uuid))));
688     return NULL;
689 }
690
691 static struct ovsdb_error *
692 ovsdb_execute_comment(struct ovsdb_execution *x, struct ovsdb_parser *parser,
693                       struct json *result UNUSED)
694 {
695     const struct json *comment;
696
697     comment = ovsdb_parser_member(parser, "comment", OP_STRING);
698     if (!comment) {
699         return NULL;
700     }
701     ovsdb_txn_add_comment(x->txn, json_string(comment));
702
703     return NULL;
704 }