[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Use ordinary C strings for filenames?

From: Karl Fogel <kfogel_at_galois.collab.net>
Date: 2000-11-10 22:19:00 CET

Jim Blandy <jimb@zwingli.cygnus.com> writes:
> While I'm at it...
>
> Since valid names in a Subversion filesystem may not contain the null
> character, it's not *necessary* to use svn_string_t for filename
> arguments to FS functions. APR, together with ANSI, provide a full
> set of primitives for dealing with standard null-terminated strings.
> And debuggers print them nicely.
>
> I never mutate a string the user passes in, so the fact that an
> svn_string_t knows its pool doesn't matter.
>
> Should I use `[const] char *' for name/path arguments to filesystem
> functions, instead of `svn_string_t'?
>
> I don't think the change will take much work.

Some thoughts:

The same thing is true of filename arguments in the working copy code,
but we still use svn_string_t, because:

   1) That's usually where the data is coming from, anyway
   2) The length is right there when you need it
   3) You can pass them to the svn_path_* functions when necessary.
      This might not happen currently in the filesystem code, but can
      we rule it out?

It's true that debuggers print char *'s nicely without any extra work,
but it's not so hard to display svn_string_t's too.
Received on Sat Oct 21 14:36:14 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.