From e32347197023ac733dcfc1eef2e1c1287ef568a1 Mon Sep 17 00:00:00 2001 From: tak Date: Thu, 3 Jan 2008 12:39:03 +0000 Subject: [PATCH] Doc updates, and small fix for Parser. --- ruby-lightmediascanner/lightmediascanner_parser.c | 31 ++++++++--------- ruby-lightmediascanner/lightmediascanner_scanner.c | 36 ++++++++++---------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/ruby-lightmediascanner/lightmediascanner_parser.c b/ruby-lightmediascanner/lightmediascanner_parser.c index e48c5c5..56f983c 100644 --- a/ruby-lightmediascanner/lightmediascanner_parser.c +++ b/ruby-lightmediascanner/lightmediascanner_parser.c @@ -29,18 +29,17 @@ typedef struct { * * Native memory deletion function * - * @return nil + * * return nil * */ -static VALUE parser_free(VALUE self) { - ParserRuby *parser; - Data_Get_Struct(self, ParserRuby, parser); +static VALUE parser_free(ParserRuby *parser) { + if(parser) { + if(parser->plugin) { + lms_parser_del(parser->parent, parser->plugin); + }// delete plugin - if(parser->plugin) { - lms_parser_del(parser->parent, parser->plugin); - }// delete plugin - - free(parser); + free(parser); + } return Qnil; }// parser_free @@ -51,9 +50,9 @@ static VALUE parser_free(VALUE self) { * * Add parser plugin, given its shared object path. * - * @param name path to shared object (usable by dlopen(3)). + * * p1 (name) path to shared object (usable by dlopen(3)). * - * @return A new Parser + * * return A new Parser * */ static VALUE scanner_add_parser(VALUE self, VALUE name) { @@ -84,15 +83,15 @@ static VALUE scanner_add_parser(VALUE self, VALUE name) { * * constructor * - * @param parent The Scanner to which the parser belongs + * * p1 (parent) The Scanner to which the parser belongs * - * @param name path to shared object (usable by dlopen(3)). + * * p2 (name) path to shared object (usable by dlopen(3)). * - * @return A new Parser + * * return A new Parser * */ static VALUE parser_new(VALUE obj, VALUE parent, VALUE name) { - lms_t *lms; + lms_t *lms = NULL; char *cname = NULL; ParserRuby *parser = NULL; lms_plugin_t *plugin = NULL; @@ -113,7 +112,7 @@ static VALUE parser_new(VALUE obj, VALUE parent, VALUE name) { parser->parent = lms; parser->plugin = plugin; - return Data_Wrap_Struct(lightmediascanner_parser, 0, parser_free, parser); + return Data_Wrap_Struct(obj, NULL, parser_free, parser); }// scanner_new /** diff --git a/ruby-lightmediascanner/lightmediascanner_scanner.c b/ruby-lightmediascanner/lightmediascanner_scanner.c index 6547a44..58e3c3d 100644 --- a/ruby-lightmediascanner/lightmediascanner_scanner.c +++ b/ruby-lightmediascanner/lightmediascanner_scanner.c @@ -26,9 +26,9 @@ * * constructor * - * @param db_path The path to the sqlite3 db to be used + * * p1 (db_path) The path to the sqlite3 db to be used * - * @return A new Scanner instance + * * return A new Scanner instance */ static VALUE scanner_new(VALUE obj, VALUE db_path) { Check_Type(db_path, T_STRING); @@ -41,9 +41,9 @@ static VALUE scanner_new(VALUE obj, VALUE db_path) { * * This will add or update media found in the given directory or its children. * - * @param top_path The top directory to scan. + * * p1 (top_path) The top directory to scan. * - * @return 0 on success + * * return 0 on success * */ static VALUE scanner_process(VALUE self, VALUE top_path) { @@ -70,9 +70,9 @@ static VALUE scanner_process(VALUE self, VALUE top_path) { * * Check consistency of the given directory. * - * @param top_path The top directory to scan. + * * p1 (top_path) The top directory to scan. * - * @return 0 on success + * * return 0 on success * */ static VALUE scanner_check(VALUE self, VALUE top_path) { @@ -99,7 +99,7 @@ static VALUE scanner_check(VALUE self, VALUE top_path) { * * Accessor for LMS DB path. * - * @return The database path given at creation time + * * return The database path given at creation time * */ static VALUE scanner_db_path(VALUE self) { @@ -115,7 +115,7 @@ static VALUE scanner_db_path(VALUE self) { * * Checks if Light Media Scanner is being used in a processing operation like lms_process() or lms_check(). * - * @return Boolean representing the instance's processing state + * * return Boolean representing the instance's processing state * */ static VALUE scanner_processing(VALUE self) { @@ -133,7 +133,7 @@ static VALUE scanner_processing(VALUE self) { * * If a slave takes more than this amount of milliseconds, it will be killed and the scanner will continue with the next file. * - * @return The timeout in milliseconds, or -1 on error + * * return The timeout in milliseconds, or -1 on error * */ static VALUE scanner_get_slave_timeout(VALUE self) { @@ -151,9 +151,9 @@ static VALUE scanner_get_slave_timeout(VALUE self) { * * If a slave takes more than this amount of milliseconds, it will be killed and the scanner will continue with the next file. * - * @param timeout_ms The timeout in milliseconds + * * p1 (timeout_ms) The timeout in milliseconds * - * @return The new timeout, in milliseconds + * * return The new timeout, in milliseconds * */ static VALUE scanner_set_slave_timeout(VALUE self, VALUE timeout_ms) { @@ -172,7 +172,7 @@ static VALUE scanner_set_slave_timeout(VALUE self, VALUE timeout_ms) { * * Get the number of files served between database transactions. * - * @return The number of files served between database transactions + * * return The number of files served between database transactions * */ static VALUE scanner_get_commit_interval(VALUE self) { @@ -188,9 +188,9 @@ static VALUE scanner_get_commit_interval(VALUE self) { * * Set the number of files to be served between database transactions. * - * @param transactions The number of files between commits + * * p1 (transactions) The number of files between commits * - * @return The new number of files to be served between database transactions + * * return The new number of files to be served between database transactions * */ static VALUE scanner_set_commit_interval(VALUE self, VALUE transactions) { @@ -211,9 +211,9 @@ static VALUE scanner_set_commit_interval(VALUE self, VALUE transactions) { * * Throws a RuntimeError if LMS is unable to add the charset. * - * @param charset charset name as understood by iconv_open(3). + * * p1 (charset) charset name as understood by iconv_open(3). * - * @return charset + * * return charset * */ static VALUE scanner_add_charset(VALUE self, VALUE charset) { @@ -239,9 +239,9 @@ static VALUE scanner_add_charset(VALUE self, VALUE charset) { * * Throws a RuntimeError if LMS is unable to remove the charset. * - * @param charset charset name as understood by iconv_open(3). + * * p1 (charset) charset name as understood by iconv_open(3). * - * @return charset + * * return charset * */ static VALUE scanner_remove_charset(VALUE self, VALUE charset) { -- 1.7.9.5