projects
/
ruby-vorbistagger.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use a flexiable array to store the filename.
[ruby-vorbistagger.git]
/
ext
/
vcedit.c
diff --git
a/ext/vcedit.c
b/ext/vcedit.c
index 832f417b2b30519cba6661b3dfb063c52a43f925..dfad95caf8a807bb5dee614e2590cfa567eaa726 100644
(file)
--- a/
ext/vcedit.c
+++ b/
ext/vcedit.c
@@
-40,8
+40,6
@@
struct vcedit_state_St {
vorbis_comment vc;
vorbis_info vi;
vorbis_comment vc;
vorbis_info vi;
- char filename[PATH_MAX];
-
FILE *in;
bool opened;
long serial;
FILE *in;
bool opened;
long serial;
@@
-53,6
+51,8
@@
struct vcedit_state_St {
int prevW;
int extrapage;
int eosin;
int prevW;
int extrapage;
int eosin;
+
+ char filename[0];
};
static void
};
static void
@@
-82,8
+82,11
@@
vcedit_state *
vcedit_state_new (const char *filename)
{
vcedit_state *state;
vcedit_state_new (const char *filename)
{
vcedit_state *state;
+ size_t len;
+
+ len = strlen (filename);
- state = malloc (sizeof (vcedit_state));
+ state = malloc (sizeof (vcedit_state)
+ len + 1
);
if (!state)
return NULL;
if (!state)
return NULL;
@@
-94,8
+97,7
@@
vcedit_state_new (const char *filename)
return NULL;
}
return NULL;
}
- snprintf (state->filename, sizeof (state->filename),
- "%s", filename);
+ strcpy (state->filename, filename);
return state;
}
return state;
}