Welcome, Guest. Please login or register.

Author Topic: Counting on AllocVec's size memo..  (Read 13620 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline CannonFodder

  • Hero Member
  • *****
  • Join Date: Sep 2003
  • Posts: 1115
    • Show all replies
Re: Counting on AllocVec's size memo..
« on: January 09, 2007, 11:10:58 PM »
Quote

koaftder wrote:
I still can't get used to that leading '{' on its own line. Am I defective? Why do people do this?


Hallelujah I am not alone in this world!

I cannot stand that.  It's ridiculous.

BSD/KNF style

Much better.
People are hostile to what they do not understand - Imam Ali ibn Abi Talib(AS)
 

Offline CannonFodder

  • Hero Member
  • *****
  • Join Date: Sep 2003
  • Posts: 1115
    • Show all replies
Re: Counting on AllocVec's size memo..
« Reply #1 on: January 09, 2007, 11:18:46 PM »
Code: [Select]

void MFreeVec( APTR memoryBlock ) {
    if (SysBase->LibNode.lib_Version >= 36) {
        FreeVec(memoryBlock);
    }

    else if (MemoryBlock) {
        unsigned long byteSize;
        unsigned long *data;

        data = (unsigned long*)memoryBlock;
        data--;
        byteSize = *data;
        FreeMem(data, byteSize);
    }
}


Much nicer. ;-)
People are hostile to what they do not understand - Imam Ali ibn Abi Talib(AS)
 

Offline CannonFodder

  • Hero Member
  • *****
  • Join Date: Sep 2003
  • Posts: 1115
    • Show all replies
Re: Counting on AllocVec's size memo..
« Reply #2 on: January 09, 2007, 11:43:54 PM »
Quote

koaftder wrote:
Quote

CannonFodder wrote:
Code: [Select]

void MFreeVec( APTR memoryBlock ) {
    if (SysBase->LibNode.lib_Version >= 36)
        FreeVec(memoryBlock);
    else if (MemoryBlock) {
        unsigned long byteSize;
        unsigned long *data;

        data = (unsigned long*)memoryBlock;
        data--;
        byteSize = *data;
        FreeMem(data, byteSize);
    }
}



sorry, had to do that.


:lol:
People are hostile to what they do not understand - Imam Ali ibn Abi Talib(AS)
 

Offline CannonFodder

  • Hero Member
  • *****
  • Join Date: Sep 2003
  • Posts: 1115
    • Show all replies
Re: Counting on AllocVec's size memo..
« Reply #3 on: January 10, 2007, 01:02:21 AM »
Quote

Piru wrote:
Oh no, yet another holy war... But of course it's a matter of taste....


Except that BSD/Allman is teh bestest!!!1

:-D


Infidel!!! ;-)
People are hostile to what they do not understand - Imam Ali ibn Abi Talib(AS)