projects
/
ruby-vorbistagger.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b1c729d
)
Use a flexiable array to store the filename.
author
Tilman Sauerbeck
<tilman@code-monkey.de>
Thu, 17 Aug 2006 16:03:15 +0000
(18:03 +0200)
committer
Tilman Sauerbeck
<tilman@code-monkey.de>
Wed, 23 Aug 2006 17:39:15 +0000
(19:39 +0200)
ext/vcedit.c
patch
|
blob
|
history
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;
}