** dav_fs_build_key: Given a resource, return a apr_datum_t key ** to look up lock information for this file. */
| 378 | ** to look up lock information for this file. |
| 379 | */ |
| 380 | static apr_datum_t dav_fs_build_key(apr_pool_t *p, |
| 381 | const dav_resource *resource) |
| 382 | { |
| 383 | const char *pathname = dav_fs_pathname(resource); |
| 384 | apr_datum_t key; |
| 385 | |
| 386 | /* ### does this allocation have a proper lifetime? need to check */ |
| 387 | /* ### can we use a buffer for this? */ |
| 388 | |
| 389 | /* size is TYPE + pathname + null */ |
| 390 | key.dsize = strlen(pathname) + 2; |
| 391 | key.dptr = apr_palloc(p, key.dsize); |
| 392 | *key.dptr = DAV_TYPE_FNAME; |
| 393 | memcpy(key.dptr + 1, pathname, key.dsize - 1); |
| 394 | if (key.dptr[key.dsize - 2] == '/') |
| 395 | key.dptr[--key.dsize - 1] = '\0'; |
| 396 | return key; |
| 397 | } |
| 398 | |
| 399 | /* |
| 400 | ** dav_fs_lock_expired: return 1 (true) if the given timeout is in the past |
no test coverage detected