view power.cpp @ 437:9a065b8db769 api-inversion

Hey, who let audioDB::set_up_query into the room? audioDB::set_up_query and audioDB::set_up_db both do all sorts of horrible pointer manipulation. Define a structure to contain all the pointers, rather than having the hideous argument lists full of double **, and use it in audioDB::set_up_query and audioDB::set_up_query_from_key. (Those two functions are desperately close to becoming one function, incidentally, or possibly even no functions given the existence of adb_datum_t...)
author mas01cr
date Wed, 24 Dec 2008 10:56:07 +0000
parents 7038f31124d1
children
line wrap: on
line source
#include "audioDB.h"
extern "C" {
#include "audioDB_API.h"
#include "audioDB-internals.h"
}

int audiodb_power(adb_t *adb) {
  if(!(adb->flags & O_RDWR)) {
    return 1;
  }
  if(adb->header->length > 0) {
    return 1;
  }

  adb->header->flags |= O2_FLAG_POWER;
  return audiodb_sync_header(adb);
}