[pulseaudio-commits] r1737 - in /branches/lennart/src/pulsecore: core-util.c core-util.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Thu Aug 30 17:51:02 PDT 2007
Author: lennart
Date: Fri Aug 31 02:51:01 2007
New Revision: 1737
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1737&root=3Dpulseaudio&vi=
ew=3Drev
Log:
add two new functions pa_make_path_absolute()/pa_getcwd()
Modified:
branches/lennart/src/pulsecore/core-util.c
branches/lennart/src/pulsecore/core-util.h
Modified: branches/lennart/src/pulsecore/core-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core-util.c?rev=3D1737&root=3Dpulseaudio&r1=3D1736&r2=3D1737&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core-util.c (original)
+++ branches/lennart/src/pulsecore/core-util.c Fri Aug 31 02:51:01 2007
@@ -1208,3 +1208,36 @@
=
return c;
}
+
+char *pa_getcwd(void) {
+ size_t l =3D 128;
+ =
+ for (;;) {
+ char *p =3D pa_xnew(char, l);
+ if (getcwd(p, l))
+ return p;
+
+ if (errno !=3D ERANGE)
+ return NULL;
+
+ pa_xfree(p);
+ l *=3D 2;
+ }
+}
+
+char *pa_make_path_absolute(const char *p) {
+ char *r;
+ char *cwd;
+ =
+ pa_assert(p);
+
+ if (p[0] =3D=3D '/')
+ return pa_xstrdup(p);
+
+ if (!(cwd =3D pa_getcwd()))
+ return pa_xstrdup(p);
+
+ r =3D pa_sprintf_malloc("%s/%s", cwd, p);
+ pa_xfree(cwd);
+ return r;
+}
Modified: branches/lennart/src/pulsecore/core-util.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
core-util.h?rev=3D1737&root=3Dpulseaudio&r1=3D1736&r2=3D1737&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/core-util.h (original)
+++ branches/lennart/src/pulsecore/core-util.h Fri Aug 31 02:51:01 2007
@@ -97,6 +97,9 @@
=
char *pa_truncate_utf8(char *c, size_t l);
=
+char *pa_getcwd(void);
+char *pa_make_path_absolute(const char *p);
+
static inline int pa_is_power_of_two(unsigned n) {
return !(n & (n - 1));
}
More information about the pulseaudio-commits
mailing list