[asterisk-commits] dlee: branch dlee/record r397910 - /team/dlee/record/res/stasis_recording/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 28 23:24:57 CDT 2013


Author: dlee
Date: Wed Aug 28 23:24:55 2013
New Revision: 397910

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397910
Log:
Address review feedback.

* const-ify format
* remove unnecessary initializer from dirent

Modified:
    team/dlee/record/res/stasis_recording/stored.c

Modified: team/dlee/record/res/stasis_recording/stored.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/stasis_recording/stored.c?view=diff&rev=397910&r1=397909&r2=397910
==============================================================================
--- team/dlee/record/res/stasis_recording/stored.c (original)
+++ team/dlee/record/res/stasis_recording/stored.c Wed Aug 28 23:24:55 2013
@@ -43,7 +43,7 @@
 		AST_STRING_FIELD(file_with_ext);	/*!< Absolute filename, with extension; for use with everything else */
 		);
 
-	char *format;	/*!< Format name (i.e. filename extension) */
+	const char *format;	/*!< Format name (i.e. filename extension) */
 };
 
 static void stored_recording_dtor(void *obj)
@@ -135,7 +135,7 @@
 static char *find_recording(const char *dir_name, const char *file)
 {
 	RAII_VAR(DIR *, dir, NULL, safe_closedir);
-	struct dirent entry = {};
+	struct dirent entry;
 	struct dirent *result = NULL;
 	char *ext = NULL;
 	char *file_with_ext = NULL;
@@ -240,6 +240,7 @@
 		ao2_cleanup);
 	RAII_VAR(struct ast_str *, name, NULL, ast_free);
 	const char *ext;
+	char *dot;
 
 	ext = strrchr(filename, '.');
 
@@ -266,8 +267,9 @@
 
 	/* Build file and format from full path */
 	ast_string_field_set(recording, file, path);
-	recording->format = strrchr(recording->file, '.');
-	*(recording->format++) = '\0';
+	dot = strrchr(recording->file, '.');
+	*dot = '\0';
+	recording->format = dot + 1;
 
 	/* Removed the recording dir from the file for the name. */
 	ast_string_field_set(recording, name,
@@ -285,7 +287,7 @@
 {
 	RAII_VAR(DIR *, dir, NULL, safe_closedir);
 	RAII_VAR(struct ast_str *, rel_dirname, NULL, ast_free);
-	struct dirent entry = {};
+	struct dirent entry;
 	struct dirent *result = NULL;
 
 	if (strcmp(dirname, ".") == 0 ||




More information about the asterisk-commits mailing list