"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/parse_table.c" between
detox-1.4.2.tar.gz and detox-1.4.3.tar.gz

About: Detox is a utility designed to clean up filenames, especially those created on other operating systems.

parse_table.c  (detox-1.4.2):parse_table.c  (detox-1.4.3)
skipping to change at line 23 skipping to change at line 23
#include <sys/stat.h> #include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <locale.h> #include <locale.h>
#include "table.h" #include "table.h"
#define LINE_LENGTH 6
enum { enum {
BASE_STATE, BASE_STATE,
INSIDE_STATE INSIDE_STATE
}; };
struct translation_table *parse_table(char *filename) struct translation_table *parse_table(char *filename)
{ {
FILE *ttable_file; FILE *ttable_file;
char *work; char *work;
int code; int code;
skipping to change at line 56 skipping to change at line 58
err = stat(filename, &ttable_stat); err = stat(filename, &ttable_stat);
if (err == -1) { if (err == -1) {
return NULL; return NULL;
} }
system_ctype = setlocale(LC_CTYPE, ""); system_ctype = setlocale(LC_CTYPE, "");
if (system_ctype == NULL) { if (system_ctype == NULL) {
system_ctype = ""; // I don't think we can free the return f rom setlocale() system_ctype = ""; // I don't think we can free the return f rom setlocale()
} }
size = 0;
if (ttable_stat.st_size > 0) { if (ttable_stat.st_size > 0) {
size = ttable_stat.st_size; size = ttable_stat.st_size / LINE_LENGTH;
} }
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
else { else {
size = (512 * ttable_stat.st_blocks); size = (512 * ttable_stat.st_blocks) / LINE_LENGTH;
} }
#endif
size /= 6;
if (size < 500) { if (size < 500) {
size = 500; size = 500;
} }
table = table_init(size); table = table_init(size);
if (table == NULL) { if (table == NULL) {
return NULL; return NULL;
} }
 End of changes. 6 change blocks. 
4 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)