Giter VIP home page Giter VIP logo

c-hashmap's Introduction

Usage

  1. create a table: Table *display_table;
  • give it a release function pointer if needed:
    void release_display(void *display) {
        Display *dis = (Display *)display;
        CFRelease(dis->uuid);
    }
    
    display_table->release = &release_display;
  1. insert the table to a bucket, passing the table, the struct value to be used as table key, and the struct to store

    table_insert(display_table, display->did, (void *)display);
  2. table_free(display_table); to clear it

  3. To get items, create a get function for whatever struct you add, taking the field you set to be the table key

    Display *get_display(int did) {
        Display *display;
        display = (Display *)table_search(display_table, did);
        return display;
    }```
  4. to delete items, create a delete function for your struct that calls table_delete_item(Table *table, int key) with the table and key

    void remove_process(ProcessSerialNumber psn) {
        table_delete_item(proc_table, psn.lowLongOfPSN);
    }

See source/display.c from mac-window for more indepth usage examples

c-hashmap's People

Contributors

a-soll avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.